Commit bf74f0bb669851bca2b9fb9b22bd58a763a05efa

Authored by alexYang
1 parent e47bb8dbb3
Exists in master

v3.3.19 FB 自动登录

Showing 5 changed files with 6 additions and 4 deletions Inline Diff

1 # Gump IOS SDK使用文档 1 # Gump IOS SDK使用文档
2 2
3 3
4 接入手册 4 接入手册
5 V 3.3.15 5 V 3.3.19
6 2016年11月09日 6 2016年11月14日
7 7
8 ## 概述 8 ## 概述
9 #### 本SDK提供gump账号,fb账号,vk账号三种账号登录,iap支付和第三方支付两种支付功能,其中gump账号登录和fb账号登录功能为必须接入,支付可根据需要选择性接入。 9 #### 本SDK提供gump账号,fb账号,vk账号三种账号登录,iap支付和第三方支付两种支付功能,其中gump账号登录和fb账号登录功能为必须接入,支付可根据需要选择性接入。
10 10
11 ## 接入步骤 11 ## 接入步骤
12 ### 1、添加Framework和资源文件 12 ### 1、添加Framework和资源文件
13 + 以下为必须添加的framework以及资源bundle: 13 + 以下为必须添加的framework以及资源bundle:
14 MobileCoreServices.framework、SystemConfiguration.framework、libz.dylib、CFNetwork.framework、GameSDK.framework、StoreKit.framework、GameSDKResources.bundle 14 MobileCoreServices.framework、SystemConfiguration.framework、libz.dylib、CFNetwork.framework、GameSDK.framework、StoreKit.framework、GameSDKResources.bundle
15 + 以下为可选,若接入vk登录则需要添加以下framework和bundle,其中VKSdk.framework和VKSDKResources.bundle请自行从vk.com下载,使用1.3版本 15 + 以下为可选,若接入vk登录则需要添加以下framework和bundle,其中VKSdk.framework和VKSDKResources.bundle请自行从vk.com下载,使用1.3版本
16 VKSdk.framework、VKBridge.framework、VKSDKResources.bundle 16 VKSdk.framework、VKBridge.framework、VKSDKResources.bundle
17 + 以下为可选,若接入bluePay第三方支付方式需要添加一下的framework和bundle,其中CoreBuePay.framework直接引入工程,之后再依次引入CoreTelephony.framework、MessageUI.framework、SystemConfiguration.framework,最后将BlueMobile.bundle拖入项目中 17 + 以下为可选,若接入bluePay第三方支付方式需要添加一下的framework和bundle,其中CoreBuePay.framework直接引入工程,之后再依次引入CoreTelephony.framework、MessageUI.framework、SystemConfiguration.framework,最后将BlueMobile.bundle拖入项目中
18 18
19 19
20 ### 2、引入头文件,设置build setting 20 ### 2、引入头文件,设置build setting
21 需要使用头文件有LetsGameAPI.h和VKBridge.h,其中VKBridge.h为接入vk时使用,不接入vk可忽略。 21 需要使用头文件有LetsGameAPI.h和VKBridge.h,其中VKBridge.h为接入vk时使用,不接入vk可忽略。
22 因sdk内使用了category,需要设置other linker flag为 -ObjC 22 因sdk内使用了category,需要设置other linker flag为 -ObjC
23 23
24 24
25 ### 3、增加必要配置 25 ### 3、增加必要配置
26 1)在application delegate中, 在application:openURL:sourceApplication:annotation:添加返回: 26 1)在application delegate中, 在application:openURL:sourceApplication:annotation:添加返回:
27 27
28 return [[LetsGameAPI instance] handleOpenURL:url sourceApplication:sourceApplication]; 28 return [[LetsGameAPI instance] handleOpenURL:url sourceApplication:sourceApplication];
29 29
30 30
31 2)配置URL-schema(vk专用,不接入vk可忽略) 31 2)配置URL-schema(vk专用,不接入vk可忽略)
32 Xcode 5: Open your application settings then select the Info tab. In the URL Types section click the plus sign. Enter vk+APP_ID (e.g. vk1234567) to the Identifier and URL Schemes fields. 32 Xcode 5: Open your application settings then select the Info tab. In the URL Types section click the plus sign. Enter vk+APP_ID (e.g. vk1234567) to the Identifier and URL Schemes fields.
33 ![](images/vk1.jpg) 33 ![](images/vk1.jpg)
34 Xcode 4: Open your Info.plist then add a new row URL Types. Set the URL identifier to vk+APP_ID 34 Xcode 4: Open your Info.plist then add a new row URL Types. Set the URL identifier to vk+APP_ID
35 ![](images/vk2.jpg) 35 ![](images/vk2.jpg)
36 36
37 3)配置plist和scheme(BluePay的linePay使用,不接入BluePay的LinePay可忽略) 37 3)配置plist和scheme(BluePay的linePay使用,不接入BluePay的LinePay可忽略)
38 38
39 plist部分: 39 plist部分:
40 <key>LSApplicationQueriesSchemes</key> 40 <key>LSApplicationQueriesSchemes</key>
41 <array> 41 <array>
42 <string>line</string> 42 <string>line</string>
43 </array> 43 </array>
44 scheme部分: 44 scheme部分:
45 <key>CFBundleURLTypes</key> 45 <key>CFBundleURLTypes</key>
46 <array> 46 <array>
47 <dict> 47 <dict>
48 <key>CFBundleTypeRole</key> 48 <key>CFBundleTypeRole</key>
49 <string>None</string> 49 <string>None</string>
50 <key>CFBundleURLName</key> 50 <key>CFBundleURLName</key>
51 <string>com.gump.sdk</string> 51 <string>com.gump.sdk</string>
52 <key>CFBundleURLSchemes</key> 52 <key>CFBundleURLSchemes</key>
53 <array> 53 <array>
54 <string> gump+游戏的appId </string> 54 <string> gump+游戏的appId </string>
55 </array> 55 </array>
56 </dict> 56 </dict>
57 </array> 57 </array>
58 ### 4、在工程里添加SDK登录代码 58 ### 4、在工程里添加SDK登录代码
59 59
60 [LetsGameAPI instance].appId = @"100"; // 设置appId 60 [LetsGameAPI instance].appId = @"100"; // 设置appId
61 [LetsGameAPI instance].appKey = @"100"; // 设置appKey 61 [LetsGameAPI instance].appKey = @"100"; // 设置appKey
62 62
63 //启用vk的代码,需要填入vk appId,若不接入vk,可以忽略 63 //启用vk的代码,需要填入vk appId,若不接入vk,可以忽略
64 //VKBridge *vkBridge = [[VKBridge alloc] initWithVKAppId:@"5029792"]; 64 //VKBridge *vkBridge = [[VKBridge alloc] initWithVKAppId:@"5029792"];
65 //[LetsGameAPI instance].vkBridge = vkBridge; 65 //[LetsGameAPI instance].vkBridge = vkBridge;
66 66
67 //隐藏fb登录 67 //隐藏fb登录
68 [LetsGameAPI disableFB:YES]; 68 [LetsGameAPI disableFB:YES];
69 69
70 //隐藏gumptech的logo 70 //隐藏gumptech的logo
71 [LetsGameAPI hiddenLogo:YES]; 71 [LetsGameAPI hiddenLogo:YES];
72 72
73 [[LetsGameAPI instance] showLoginView]; // 弹出登录页面 73 [[LetsGameAPI instance] showLoginView]; // 弹出登录页面
74 74
75 // 登录成功回调 75 // 登录成功回调
76 [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) { 76 [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) {
77 NSLog(@"%@", [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %d", userId, sessionKey, type]); 77 NSLog(@"%@", [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %d", userId, sessionKey, type]);
78 }; 78 };
79 79
80 // 登录失败回调 80 // 登录失败回调
81 [LetsGameAPI instance].dismissBlock = ^() { 81 [LetsGameAPI instance].dismissBlock = ^() {
82 NSLog(@"dismiss without login"); 82 NSLog(@"dismiss without login");
83 }; 83 };
84 84
85 85
86 ### 5、第三方支付 86 ### 5、第三方支付
87 [LetsGameAPI instance].appId = @"10022"; 87 [LetsGameAPI instance].appId = @"10022";
88 [LetsGameAPI instance].appKey = @"f899139df5e1059396431415e770c6dd"; 88 [LetsGameAPI instance].appKey = @"f899139df5e1059396431415e770c6dd";
89 NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; 89 NSMutableDictionary *payInfo = [NSMutableDictionary dictionary];
90 [payInfo setValue:@"5001" forKey:@"serverId"];//服务器id,必传参数 90 [payInfo setValue:@"5001" forKey:@"serverId"];//服务器id,必传参数
91 [payInfo setValue:@"10010" forKey:@"roleId"];//用户角色id 91 [payInfo setValue:@"10010" forKey:@"roleId"];//用户角色id
92 [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id 92 [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id
93 [payInfo setValue:@"10" forKey:@"amount"];//金额 93 [payInfo setValue:@"10" forKey:@"amount"];//金额
94 [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//外部订单信息 94 [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//外部订单信息
95 [payInfo setValue:@"元宝" forKey:@"product"];//物品信息 95 [payInfo setValue:@"元宝" forKey:@"product"];//物品信息
96 [payInfo setValue:self.sessionKey forKey:@"sessionKey"];//登录成功的sessionKey 96 [payInfo setValue:self.sessionKey forKey:@"sessionKey"];//登录成功的sessionKey
97 [payInfo setValue:@"1" forKey:@"iosBlue"];//接入完BluePay,需要使用时需要的标志位 97 [payInfo setValue:@"1" forKey:@"iosBlue"];//接入完BluePay,需要使用时需要的标志位
98 [[LetsGameAPI instance] pay:payInfo handleCallBack:^{ 98 [[LetsGameAPI instance] pay:payInfo handleCallBack:^{
99 //第三方支付完成时的回调(包括支付成功和支付失败,除了支付过程中取消的),取消的不会有回调 99 //第三方支付完成时的回调(包括支付成功和支付失败,除了支付过程中取消的),取消的不会有回调
100 NSLog(@"第三方支付完成"); 100 NSLog(@"第三方支付完成");
101 }]]; 101 }]];
102 102
103 ### 6、IAP支付 103 ### 6、IAP支付
104 若要使用apple IAP支付,需要在AppDelegate的application: didFinishLaunchingWithOptions:方法内注册iap observer,使用如下方法 104 若要使用apple IAP支付,需要在AppDelegate的application: didFinishLaunchingWithOptions:方法内注册iap observer,使用如下方法
105 105
106 [[LetsGameAPI instance] registeIapObserver]; 106 [[LetsGameAPI instance] registeIapObserver];
107 具体调用iap支付的方法如下: 107 具体调用iap支付的方法如下:
108 108
109 [LetsGameAPI instance].appId = @"10022"; 109 [LetsGameAPI instance].appId = @"10022";
110 [LetsGameAPI instance].appKey = @"93a27b0bd99bac3e68a440b48aa421ab"; 110 [LetsGameAPI instance].appKey = @"93a27b0bd99bac3e68a440b48aa421ab";
111 NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; 111 NSMutableDictionary *payInfo = [NSMutableDictionary dictionary];
112 [payInfo setValue:@"5001" forKey:@"serverId"];//当前用户所在的服务器Id 112 [payInfo setValue:@"5001" forKey:@"serverId"];//当前用户所在的服务器Id
113 [payInfo setValue:@"10010" forKey:@"roleId"];//当前用户的角色id 113 [payInfo setValue:@"10010" forKey:@"roleId"];//当前用户的角色id
114 [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id,用于统计 114 [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id,用于统计
115 [payInfo setValue:@"10" forKey:@"amount"];//对应支付项的支付金额,实际支付金额以itunes配置为准 115 [payInfo setValue:@"10" forKey:@"amount"];//对应支付项的支付金额,实际支付金额以itunes配置为准
116 [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//扩展信息,可以游戏自定义,建议传自有订单号 116 [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//扩展信息,可以游戏自定义,建议传自有订单号
117 [payInfo setValue:@"test.product.1" forKey:@"product"];//itunes 后台配置的对应支付项的productId 117 [payInfo setValue:@"test.product.1" forKey:@"product"];//itunes 后台配置的对应支付项的productId
118 [[LetsGameAPI instance] iap:payInfo forUser:@"" handleCallback:^(NSString* orderId){ 118 [[LetsGameAPI instance] iap:payInfo forUser:@"" handleCallback:^(NSString* orderId){
119 //此处的回调表明支付已经完成,但此时支付不一定成功,需要服务端验证支付结果 119 //此处的回调表明支付已经完成,但此时支付不一定成功,需要服务端验证支付结果
120 //orderId为gump生成的订单号,此订单号可以在gump server查询此笔支付是否成功 120 //orderId为gump生成的订单号,此订单号可以在gump server查询此笔支付是否成功
121 NSLog(@"iap completed orderId of gumptech:%@",orderId); 121 NSLog(@"iap completed orderId of gumptech:%@",orderId);
122 }]; 122 }];
123 ### 7、SDK版本测试设置 123 ### 7、SDK版本测试设置
124 若想使用SDK的debug版本,需要在AppDelegate的application: didFinishLaunchingWithOptions:中设置: 124 若想使用SDK的debug版本,需要在AppDelegate的application: didFinishLaunchingWithOptions:中设置:
125 125
126 [[LetsGameAPI instance] decideIsDebug:1]; 126 [[LetsGameAPI instance] decideIsDebug:1];
127 不设置或者设置为0时,默认使用release版本 127 不设置或者设置为0时,默认使用release版本
128 128
ios/GameSDK.framework/Versions/A/GameSDK
No preview for this file type
ios/GameSDK.framework/Versions/A/Headers/LetsGameAPI.h
1 1
2 #import <Foundation/Foundation.h> 2 #import <Foundation/Foundation.h>
3 #import "LSGAccount.h" 3 #import "LSGAccount.h"
4 #import "VKBridgeProtocol.h" 4 #import "VKBridgeProtocol.h"
5 5
6 6
7 typedef void (^LSGLoginSuccBlock)(NSString *userId, NSString *sessionKey, LSGAccountType type); 7 typedef void (^LSGLoginSuccBlock)(NSString *userId, NSString *sessionKey, LSGAccountType type);
8
9 typedef void (^LSGDismissBlock)(void); 8 typedef void (^LSGDismissBlock)(void);
10 9
11 static BOOL isDisableFB = NO; 10 static BOOL isDisableFB = NO;
12 11
13 static BOOL isEnableVK = NO; 12 static BOOL isEnableVK = NO;
14 13
15 static BOOL hiddenLogo = NO; 14 static BOOL hiddenLogo = NO;
16 15
17 static NSString *version = @"3.3.16"; 16 static NSString *version = @"3.3.19";
18 17
19 @interface LetsGameAPI : NSObject<UIApplicationDelegate> 18 @interface LetsGameAPI : NSObject<UIApplicationDelegate>
20 19
21 @property (nonatomic, strong) NSString *appId; 20 @property (nonatomic, strong) NSString *appId;
22 @property (nonatomic, strong) NSString *appKey; 21 @property (nonatomic, strong) NSString *appKey;
23 @property (nonatomic, copy) LSGLoginSuccBlock succBlock; 22 @property (nonatomic, copy) LSGLoginSuccBlock succBlock;
24 @property (nonatomic, copy) LSGDismissBlock dismissBlock; 23 @property (nonatomic, copy) LSGDismissBlock dismissBlock;
25 @property (nonatomic, assign) int isDebug; 24 @property (nonatomic, assign) int isDebug;
26 @property (nonatomic, assign) int decideWebPay; 25 @property (nonatomic, assign) int decideWebPay;
27 @property (nonatomic,retain) id<VKBridgeProtocol> vkBridge; 26 @property (nonatomic,retain) id<VKBridgeProtocol> vkBridge;
28 //@property(nonatomic,strong) NSString *version; 27 //@property(nonatomic,strong) NSString *version;
29 28
30 + (instancetype)instance; 29 + (instancetype)instance;
31 30
32 -(NSString*)version; 31 -(NSString*)version;
33 32
34 - (void)showLoginView; 33 - (void)showLoginView;
35 - (void)showLoginViewInView:(UIView *)view; 34 - (void)showLoginViewInView:(UIView *)view;
36 35
37 +(void)disableFB:(BOOL)isDisable; 36 +(void)disableFB:(BOOL)isDisable;
38 +(BOOL)isFBDisable; 37 +(BOOL)isFBDisable;
39 +(BOOL)isVKEnable; 38 +(BOOL)isVKEnable;
40 +(void)hiddenLogo:(BOOL)isHidden; 39 +(void)hiddenLogo:(BOOL)isHidden;
41 +(BOOL)isHiddenLogo; 40 +(BOOL)isHiddenLogo;
42 41
43 - (void)logout; 42 - (void)logout;
44 43
45 - (void)hide; 44 - (void)hide;
46 45
47 - (BOOL)handleOpenURL:(NSURL *)url 46 - (BOOL)handleOpenURL:(NSURL *)url
48 sourceApplication:(NSString *)sourceApplication; 47 sourceApplication:(NSString *)sourceApplication;
49 48
50 -(void)pay:(NSDictionary*) payInfo handleCallBack:(void (^)()) paySuccessCallback; 49 -(void)pay:(NSDictionary*) payInfo handleCallBack:(void (^)()) paySuccessCallback;
51 50
52 -(void)iap:(NSDictionary*) payInfo forUser:(NSString*) uid handleCallback:(void (^)(NSString* orderId)) callback; 51 -(void)iap:(NSDictionary*) payInfo forUser:(NSString*) uid handleCallback:(void (^)(NSString* orderId)) callback;
53 52
54 -(void)registeIapObserver; 53 -(void)registeIapObserver;
55 54
56 -(void)decideIsDebug:(int)isDebug; 55 -(void)decideIsDebug:(int)isDebug;
57 56
58 -(void)decideWebPayVersion:(int)decideWebPay; 57 -(void)decideWebPayVersion:(int)decideWebPay;
58
59 -(void)obtainAccessTokenSuccess:(void (^)(NSString *tokenString, NSString *refreshTime, NSString *expirationTime))success
60 failure:(void (^)(NSString *errorString))failure;
59 @end 61 @end
No preview for this file type
ios/GameSDKDemo/GameSDKDemo.xcodeproj/project.xcworkspace/xcuserdata/yanglele.xcuserdatad/UserInterfaceState.xcuserstate
No preview for this file type