Commit 90eed546b9d2734891f5d840fd16e3b679e5e338
1 parent
d6d51df0d0
Exists in
master
文档、demo注释修改
Showing 4 changed files with 3 additions and 2 deletions Inline Diff
IOSDocument.md
| 1 | # Gump IOS SDK使用文档 | 1 | # Gump IOS SDK使用文档 |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | 接入手册 | 4 | 接入手册 |
| 5 | V 3.5.22 | 5 | V 3.5.22 |
| 6 | 2018年8月31日 | 6 | 2018年8月31日 |
| 7 | 7 | ||
| 8 | ## 概述 | 8 | ## 概述 |
| 9 | #### 本SDK提供gump账号,fb账号,vk账号,Google帐号四种账号登录,iap支付和第三方支付两种支付功能,其中gump账号登录和fb账号登录功能为必须接入,支付可根据需要选择性接入。 | 9 | #### 本SDK提供gump账号,fb账号,vk账号,Google帐号四种账号登录,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 | + 以下可选,若接入微信登陆则需要添加如下的framework: | 17 | + 以下可选,若接入微信登陆则需要添加如下的framework: |
| 18 | libsqlite3.0.dylib, libc++.dylib, Security.framework, CoreTelephony.framework, CFNetwork.framework | 18 | libsqlite3.0.dylib, libc++.dylib, Security.framework, CoreTelephony.framework, CFNetwork.framework |
| 19 | 19 | ||
| 20 | 20 | ||
| 21 | ### 2、引入头文件,设置build setting | 21 | ### 2、引入头文件,设置build setting |
| 22 | 需要使用头文件有LetsGameAPI.h和VKBridge.h,其中VKBridge.h为接入vk时使用,不接入vk可忽略。 | 22 | 需要使用头文件有LetsGameAPI.h和VKBridge.h,其中VKBridge.h为接入vk时使用,不接入vk可忽略。 |
| 23 | 因sdk内使用了category,需要设置other linker flag为 -ObjC | 23 | 因sdk内使用了category,需要设置other linker flag为 -ObjC |
| 24 | 24 | ||
| 25 | 25 | ||
| 26 | ### 3、增加必要配置 | 26 | ### 3、增加必要配置 |
| 27 | 1)在application delegate中, 在application:openURL:sourceApplication:annotation:添加返回: | 27 | 1)在application delegate中, 在application:openURL:sourceApplication:annotation:添加返回: |
| 28 | 28 | ||
| 29 | return [[LetsGameAPI instance] handleOpenURL:url sourceApplication:sourceApplication]; | 29 | return [[LetsGameAPI instance] handleOpenURL:url sourceApplication:sourceApplication]; |
| 30 | 30 | ||
| 31 | 31 | ||
| 32 | 2)配置URL-schema(vk专用,不接入vk可忽略) | 32 | 2)配置URL-schema(vk专用,不接入vk可忽略) |
| 33 | 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 | 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. |
| 34 |  | 34 |  |
| 35 | Xcode 4: Open your Info.plist then add a new row URL Types. Set the URL identifier to vk+APP_ID | 35 | Xcode 4: Open your Info.plist then add a new row URL Types. Set the URL identifier to vk+APP_ID |
| 36 |  | 36 |  |
| 37 | 3)配置URL-schema(weChat专用,不接入可以忽略) | 37 | 3)配置URL-schema(weChat专用,不接入可以忽略) |
| 38 | 选中“TARGETS”一栏,在“info”标签栏的“URL type“添加“URL scheme”为你所注册的应用程序id | 38 | 选中“TARGETS”一栏,在“info”标签栏的“URL type“添加“URL scheme”为你所注册的应用程序id |
| 39 | 选中“TARGETS”一栏,在“info”标签栏的“LSApplicationQueriesSchemes“添加weixin和wechat | 39 | 选中“TARGETS”一栏,在“info”标签栏的“LSApplicationQueriesSchemes“添加weixin和wechat |
| 40 | 40 | ||
| 41 | ### 4、在工程里添加SDK登录代码 | 41 | ### 4、在工程里添加SDK登录代码 |
| 42 | 42 | ||
| 43 | [LetsGameAPI instance].appId = @"100"; // 设置appId | 43 | [LetsGameAPI instance].appId = @"100"; // 设置appId |
| 44 | [LetsGameAPI instance].appKey = @"100"; // 设置appKey | 44 | [LetsGameAPI instance].appKey = @"100"; // 设置appKey |
| 45 | [LetsGameAPI instance].channelId = @"100"; //设置channelId | 45 | [LetsGameAPI instance].channelId = @"100"; //设置channelId |
| 46 | 46 | ||
| 47 | //启用vk的代码,需要填入vk appId,若不接入vk,可以忽略 | 47 | //启用vk的代码,需要填入vk appId,若不接入vk,可以忽略 |
| 48 | //VKBridge *vkBridge = [[VKBridge alloc] initWithVKAppId:@"5029792"]; | 48 | //VKBridge *vkBridge = [[VKBridge alloc] initWithVKAppId:@"5029792"]; |
| 49 | //[LetsGameAPI instance].vkBridge = vkBridge; | 49 | //[LetsGameAPI instance].vkBridge = vkBridge; |
| 50 | 50 | ||
| 51 | //隐藏fb登录 | 51 | //隐藏fb登录 |
| 52 | [LetsGameAPI disableFB:YES]; | 52 | [LetsGameAPI disableFB:YES]; |
| 53 | //隐藏Google登录 | 53 | //隐藏Google登录 |
| 54 | [LetsGameAPI disableGoogle:YES]; | 54 | [LetsGameAPI disableGoogle:YES]; |
| 55 | //隐藏gumptech的logo | 55 | //隐藏gumptech的logo |
| 56 | [LetsGameAPI hiddenLogo:YES]; | 56 | [LetsGameAPI hiddenLogo:YES]; |
| 57 | //隐藏line登录 | 57 | //隐藏line登录 |
| 58 | [LetsGameAPI disableLine:YES]; | 58 | [LetsGameAPI disableLine:YES]; |
| 59 | //隐藏wechat登录 | 59 | //隐藏wechat登录 |
| 60 | [LetsGameAPI disableWeChat:YES]; | 60 | [LetsGameAPI disableWeChat:YES]; |
| 61 | 61 | ||
| 62 | [[LetsGameAPI instance] showLoginView]; // 弹出登录页面 | 62 | [[LetsGameAPI instance] showLoginView]; // 弹出登录页面 |
| 63 | 63 | ||
| 64 | // 登录成功回调 | 64 | // 登录成功回调 |
| 65 | [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) { | 65 | [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) { |
| 66 | NSLog(@"%@", [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %d", userId, sessionKey, type]); | 66 | NSLog(@"%@", [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %d", userId, sessionKey, type]); |
| 67 | }; | 67 | }; |
| 68 | 68 | ||
| 69 | // 登录失败回调 | 69 | // 登录失败回调,需要游戏自己处理 |
| 70 | [LetsGameAPI instance].dismissBlock = ^() { | 70 | [LetsGameAPI instance].dismissBlock = ^() { |
| 71 | NSLog(@"dismiss without login"); | 71 | NSLog(@"dismiss without login"); |
| 72 | }; | 72 | }; |
| 73 | 73 | ||
| 74 | ### 5、登录注销 | 74 | ### 5、登录注销 |
| 75 | 注销接口只要设置过appId和appKey之后就不需要设置了,注销完成之后会回到登录界面。FB登录回到登录页面,Gump登录或者游客登录回到登录框。 | 75 | 注销接口只要设置过appId和appKey之后就不需要设置了,注销完成之后会回到登录界面。FB登录回到登录页面,Gump登录或者游客登录回到登录框。 |
| 76 | 76 | ||
| 77 | [LetsGameAPI instance].appId = @"100";//设置appId | 77 | [LetsGameAPI instance].appId = @"100";//设置appId |
| 78 | [LetsGameAPI instance].appKey = @"100";//设置appkey | 78 | [LetsGameAPI instance].appKey = @"100";//设置appkey |
| 79 | [[LetsGameAPI instance] logout]; //注销 | 79 | [[LetsGameAPI instance] logout]; //注销 |
| 80 | 80 | ||
| 81 | 81 | ||
| 82 | ### 6、第三方支付 | 82 | ### 6、第三方支付 |
| 83 | [LetsGameAPI instance].appId = @"10022"; | 83 | [LetsGameAPI instance].appId = @"10022"; |
| 84 | [LetsGameAPI instance].appKey = @"f899139df5e1059396431415e770c6dd"; | 84 | [LetsGameAPI instance].appKey = @"f899139df5e1059396431415e770c6dd"; |
| 85 | NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; | 85 | NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; |
| 86 | [payInfo setValue:@"5001" forKey:@"serverId"];//服务器id,必传参数 | 86 | [payInfo setValue:@"5001" forKey:@"serverId"];//服务器id,必传参数 |
| 87 | [payInfo setValue:@"10010" forKey:@"roleId"];//用户角色id | 87 | [payInfo setValue:@"10010" forKey:@"roleId"];//用户角色id |
| 88 | [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id | 88 | [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id |
| 89 | [payInfo setValue:@"10" forKey:@"amount"];//金额 | 89 | [payInfo setValue:@"10" forKey:@"amount"];//金额 |
| 90 | [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//外部订单信息 | 90 | [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//外部订单信息 |
| 91 | [payInfo setValue:@"元宝" forKey:@"product"];//物品ID | 91 | [payInfo setValue:@"元宝" forKey:@"product"];//物品ID |
| 92 | [payInfo setValue:self.sessionKey forKey:@"sessionKey"];//登录成功的sessionKey | 92 | [payInfo setValue:self.sessionKey forKey:@"sessionKey"];//登录成功的sessionKey |
| 93 | [[LetsGameAPI instance] pWeb:payInfo handleCallBack:^{ | 93 | [[LetsGameAPI instance] pWeb:payInfo handleCallBack:^{ |
| 94 | //第三方支付完成时的回调(包括支付成功和支付失败,除了支付过程中取消的),取消的不会有回调 | 94 | //第三方支付完成时的回调(包括支付成功和支付失败,除了支付过程中取消的),取消的不会有回调 |
| 95 | NSLog(@"第三方支付完成"); | 95 | NSLog(@"第三方支付完成"); |
| 96 | }]]; | 96 | }]]; |
| 97 | 97 | ||
| 98 | ### 7、IAP支付 | 98 | ### 7、IAP支付 |
| 99 | 若要使用apple IAP支付,需要在AppDelegate的application: didFinishLaunchingWithOptions:方法内注册iap observer,使用如下方法 | 99 | 若要使用apple IAP支付,需要在AppDelegate的application: didFinishLaunchingWithOptions:方法内注册iap observer,使用如下方法 |
| 100 | 100 | ||
| 101 | [[LetsGameAPI instance] registeIapObserver]; | 101 | [[LetsGameAPI instance] registeIapObserver]; |
| 102 | 具体调用iap支付的方法如下: | 102 | 具体调用iap支付的方法如下: |
| 103 | 103 | ||
| 104 | [LetsGameAPI instance].appId = @"10022"; | 104 | [LetsGameAPI instance].appId = @"10022"; |
| 105 | [LetsGameAPI instance].appKey = @"93a27b0bd99bac3e68a440b48aa421ab"; | 105 | [LetsGameAPI instance].appKey = @"93a27b0bd99bac3e68a440b48aa421ab"; |
| 106 | NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; | 106 | NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; |
| 107 | [payInfo setValue:@"5001" forKey:@"serverId"];//当前用户所在的服务器Id | 107 | [payInfo setValue:@"5001" forKey:@"serverId"];//当前用户所在的服务器Id |
| 108 | [payInfo setValue:@"10010" forKey:@"roleId"];//当前用户的角色id | 108 | [payInfo setValue:@"10010" forKey:@"roleId"];//当前用户的角色id |
| 109 | [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id,用于统计 | 109 | [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id,用于统计 |
| 110 | [payInfo setValue:@"10" forKey:@"amount"];//对应支付项的支付金额,实际支付金额以itunes配置为准 | 110 | [payInfo setValue:@"10" forKey:@"amount"];//对应支付项的支付金额,实际支付金额以itunes配置为准 |
| 111 | [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//扩展信息,可以游戏自定义,建议传自有订单号 | 111 | [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//扩展信息,可以游戏自定义,建议传自有订单号 |
| 112 | [payInfo setValue:@"test.product.1" forKey:@"product"];//itunes 后台配置的对应支付项的productId | 112 | [payInfo setValue:@"test.product.1" forKey:@"product"];//itunes 后台配置的对应支付项的productId |
| 113 | [[LetsGameAPI instance] iap:payInfo forUser:@"" succCallback:^(NSString *orderId) { | 113 | [[LetsGameAPI instance] iap:payInfo forUser:@"" succCallback:^(NSString *orderId) { |
| 114 | //此处的回调表明支付已经完成,但此时支付不一定成功,需要服务端验证支付结果 | 114 | //此处的回调表明支付已经完成,但此时支付不一定成功,需要服务端验证支付结果 |
| 115 | //orderId为gump生成的订单号,此订单号可以在gump server查询此笔支付是否成功 | 115 | //orderId为gump生成的订单号,此订单号可以在gump server查询此笔支付是否成功 |
| 116 | NSLog(@"IAP completed orderId of Gumptech:%@",orderId); | 116 | NSLog(@"IAP completed orderId of Gumptech:%@",orderId); |
| 117 | } failCallback:^(NSString *orderId) { | 117 | } failCallback:^(NSString *orderId) { |
| 118 | //支付失败 | 118 | //支付失败 |
| 119 | NSLog(@"IAP file orderId of Gumptech:%@",orderId); | 119 | NSLog(@"IAP file orderId of Gumptech:%@",orderId); |
| 120 | }]; | 120 | }]; |
| 121 | ### 8、token的获取 | 121 | ### 8、token的获取 |
| 122 | FB登录之后会产生token并自动登录,需要如果需要token的话,需要自己调用接口获取。 | 122 | FB登录之后会产生token并自动登录,需要如果需要token的话,需要自己调用接口获取。 |
| 123 | 123 | ||
| 124 | //tokenString:token字符串 | 124 | //tokenString:token字符串 |
| 125 | //refreshTime:refreshTime token最后刷新的时间,即获取的token的时间 | 125 | //refreshTime:refreshTime token最后刷新的时间,即获取的token的时间 |
| 126 | //expirationTime:expirationTime token最后的有效时间 | 126 | //expirationTime:expirationTime token最后的有效时间 |
| 127 | [[LetsGameAPI instance] obtainAccessTokenSuccess:^(NSString *tokenString, NSString *refreshTime, NSString *expirationTime) { | 127 | [[LetsGameAPI instance] obtainAccessTokenSuccess:^(NSString *tokenString, NSString *refreshTime, NSString *expirationTime) { |
| 128 | NSLog(@"tokenString %@, refreshTime %@, expirationTime %@", tokenString, refreshTime, expirationTime); | 128 | NSLog(@"tokenString %@, refreshTime %@, expirationTime %@", tokenString, refreshTime, expirationTime); |
| 129 | } failure:^(NSString *errorString) { | 129 | } failure:^(NSString *errorString) { |
| 130 | NSLog(@"get token faile"); | 130 | NSLog(@"get token faile"); |
| 131 | }]; | 131 | }]; |
| 132 | 132 | ||
| 133 | 133 | ||
| 134 | ### 9、第三方支付版本 | 134 | ### 9、第三方支付版本 |
| 135 | 第三方支付,分成两个版本:没有gump币和有gump币,不设置时默认为不带gump币版本,如果使用带gump币的版本如下设置: | 135 | 第三方支付,分成两个版本:没有gump币和有gump币,不设置时默认为不带gump币版本,如果使用带gump币的版本如下设置: |
| 136 | 136 | ||
| 137 | 需要在 application:didFinishLaunchingWithOptions方法中添加: | 137 | 需要在 application:didFinishLaunchingWithOptions方法中添加: |
| 138 | 138 | ||
| 139 | [[LetsGameAPI instance] decideWebToVersion:1] | 139 | [[LetsGameAPI instance] decideWebToVersion:1] |
| 140 | 140 | ||
| 141 | 141 | ||
| 142 | ### 10、关于侵权还是侵权的接口显示 | 142 | ### 10、关于侵权还是侵权的接口显示 |
| 143 | 运营在后台配置此包名和版本在什么时候显示侵权内容还是不侵权内容,此接口调用需要在游戏才开始加载的时候调用,返回值是YES的时候显示侵权内容,在NO的时候显示不侵权内容。 | 143 | 运营在后台配置此包名和版本在什么时候显示侵权内容还是不侵权内容,此接口调用需要在游戏才开始加载的时候调用,返回值是YES的时候显示侵权内容,在NO的时候显示不侵权内容。 |
| 144 | 144 | ||
| 145 | 注意:关于运营配置的游戏的版本号,我们默认取的是Bulid版本号的值,请注意。 | 145 | 注意:关于运营配置的游戏的版本号,我们默认取的是Bulid版本号的值,请注意。 |
| 146 | 146 | ||
| 147 | [[LetsGameAPI instance] gameObtainSafeSetInfoWithAppId:@"10056" ChannelId:@"1000" handleCallBack:^(BOOL resultStatus) { | 147 | [[LetsGameAPI instance] gameObtainSafeSetInfoWithAppId:@"10056" ChannelId:@"1000" handleCallBack:^(BOOL resultStatus) { |
| 148 | if (resultStatus) { | 148 | if (resultStatus) { |
| 149 | NSLog(@"YES 侵权"); | 149 | NSLog(@"YES 侵权"); |
| 150 | }else{ | 150 | }else{ |
| 151 | NSLog(@"NO 不侵权"); | 151 | NSLog(@"NO 不侵权"); |
| 152 | } | 152 | } |
| 153 | }]; | 153 | }]; |
| 154 | ### 11、横竖屏设置 | 154 | ### 11、横竖屏设置 |
| 155 | 155 | ||
| 156 | 首先设置SDK默认是横屏,在General->Deployment Info->Device Orientain下,只选择Landscape Left 和 Landscape Right,SDK的界面默认是横屏。 | 156 | 首先设置SDK默认是横屏,在General->Deployment Info->Device Orientain下,只选择Landscape Left 和 Landscape Right,SDK的界面默认是横屏。 |
| 157 | 其次如果想使用竖屏的模式,需要在General->Deployment Info->Device Orientain下,只选择Portrait模式,并且需要在AppDelegate中的方法: | 157 | 其次如果想使用竖屏的模式,需要在General->Deployment Info->Device Orientain下,只选择Portrait模式,并且需要在AppDelegate中的方法: |
| 158 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;靠前的位置添加代码设置: | 158 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;靠前的位置添加代码设置: |
| 159 | 159 | ||
| 160 | [LetsGameAPI DeviceOrientationIsHorizontal:NO]; | 160 | [LetsGameAPI DeviceOrientationIsHorizontal:NO]; |
| 161 | 161 | ||
| 162 | 162 | ||
| 163 | 163 | ||
| 164 | 164 | ||
| 165 | 165 | ||
| 166 | ### 12、微信登陆 | 166 | ### 12、微信登陆 |
| 167 | 167 | ||
| 168 | 首先在- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;方法中向微信注册应用 | 168 | 首先在- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;方法中向微信注册应用 |
| 169 | //微信登陆 | 169 | //微信登陆 |
| 170 | [[LetsGameAPI instance] registerAppWeChatWithAppId:@"appId" appKey:@"appKey" Success:^{ | 170 | [[LetsGameAPI instance] registerAppWeChatWithAppId:@"appId" appKey:@"appKey" Success:^{ |
| 171 | NSLog(@"注册成功"); | 171 | NSLog(@"注册成功"); |
| 172 | } failure:^{ | 172 | } failure:^{ |
| 173 | NSLog(@"注册失败"); | 173 | NSLog(@"注册失败"); |
| 174 | }]; | 174 | }]; |
| 175 | 175 | ||
| 176 | 176 | ||
| 177 | ### 13、CocoaPods集成 | 177 | ### 13、CocoaPods集成 |
| 178 | 集成项目的.framework和bundle,但是vk登录封装的VK.framework,需要自己手动添加。 | 178 | 集成项目的.framework和bundle,但是vk登录封装的VK.framework,需要自己手动添加。 |
| 179 | ``` | 179 | ``` |
| 180 | pod 'GameSDK', '~> 3.5.5' | 180 | pod 'GameSDK', '~> 3.5.5' |
| 181 | ``` | 181 | ``` |
| 182 | 182 | ||
| 183 | ### 14、活动添加 | 183 | ### 14、活动添加 |
| 184 | 添加项目GameActivitySDK.framework | 184 | 添加项目GameActivitySDK.framework |
| 185 | 设置:设置xxxx.plist | 185 | 设置:设置xxxx.plist |
| 186 | 只支持HTTP的方式,需要将相应的项目的xxx.plist添加Information Property List->App Transport Security Settings -> Allow Arbitrary Loads设置为YES | 186 | 只支持HTTP的方式,需要将相应的项目的xxx.plist添加Information Property List->App Transport Security Settings -> Allow Arbitrary Loads设置为YES |
| 187 | 187 | ||
| 188 | 工程中添加SDK登录代码: | 188 | 工程中添加SDK登录代码: |
| 189 | 189 | ||
| 190 | NSMutableDictionary *activityInfo = [NSMutableDictionary dictionary]; | 190 | NSMutableDictionary *activityInfo = [NSMutableDictionary dictionary]; |
| 191 | [activityInfo setValue:@"100" forKey:@"appId"]; | 191 | [activityInfo setValue:@"100" forKey:@"appId"]; |
| 192 | [activityInfo setValue:@"f899139df5e1059396431415e770c6dd" forKey:@"appKey"]; | 192 | [activityInfo setValue:@"f899139df5e1059396431415e770c6dd" forKey:@"appKey"]; |
| 193 | [activityInfo setValue:@"123456" forKey:@"userId"]; | 193 | [activityInfo setValue:@"123456" forKey:@"userId"]; |
| 194 | [activityInfo setValue:@"111" forKey:@"serverId"]; | 194 | [activityInfo setValue:@"111" forKey:@"serverId"]; |
| 195 | [activityInfo setValue:@"aaa" forKey:@"serverName"]; | 195 | [activityInfo setValue:@"aaa" forKey:@"serverName"]; |
| 196 | [activityInfo setValue:@"222" forKey:@"roleId"]; | 196 | [activityInfo setValue:@"222" forKey:@"roleId"]; |
| 197 | [activityInfo setValue:@"ccc" forKey:@"roleName"]; | 197 | [activityInfo setValue:@"ccc" forKey:@"roleName"]; |
| 198 | [activityInfo setValue:@"888" forKey:@"diamond"]; | 198 | [activityInfo setValue:@"888" forKey:@"diamond"]; |
| 199 | //活动关闭的回调 | 199 | //活动关闭的回调 |
| 200 | [[LetsGameActivityAPI instance] GameActivityWithParaDictory:activityInfo handleCallBackL:^{ | 200 | [[LetsGameActivityAPI instance] GameActivityWithParaDictory:activityInfo handleCallBackL:^{ |
| 201 | NSLog(@"activity finish!"); | 201 | NSLog(@"activity finish!"); |
| 202 | }]; | 202 | }]; |
| 203 | 203 |
README.md
| 1 | # Gump IOS SDK使用文档 | 1 | # Gump IOS SDK使用文档 |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | 接入手册 | 4 | 接入手册 |
| 5 | V 3.5.22 | 5 | V 3.5.22 |
| 6 | 2018年8月31日 | 6 | 2018年8月31日 |
| 7 | 7 | ||
| 8 | ## 概述 | 8 | ## 概述 |
| 9 | #### 本SDK提供gump账号,fb账号,vk账号,Google帐号四种账号登录,iap支付和第三方支付两种支付功能,其中gump账号登录和fb账号登录功能为必须接入,支付可根据需要选择性接入。 | 9 | #### 本SDK提供gump账号,fb账号,vk账号,Google帐号四种账号登录,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 | + 以下可选,若接入微信登陆则需要添加如下的framework: | 17 | + 以下可选,若接入微信登陆则需要添加如下的framework: |
| 18 | libsqlite3.0.dylib, libc++.dylib, Security.framework, CoreTelephony.framework, CFNetwork.framework | 18 | libsqlite3.0.dylib, libc++.dylib, Security.framework, CoreTelephony.framework, CFNetwork.framework |
| 19 | 19 | ||
| 20 | 20 | ||
| 21 | ### 2、引入头文件,设置build setting | 21 | ### 2、引入头文件,设置build setting |
| 22 | 需要使用头文件有LetsGameAPI.h和VKBridge.h,其中VKBridge.h为接入vk时使用,不接入vk可忽略。 | 22 | 需要使用头文件有LetsGameAPI.h和VKBridge.h,其中VKBridge.h为接入vk时使用,不接入vk可忽略。 |
| 23 | 因sdk内使用了category,需要设置other linker flag为 -ObjC | 23 | 因sdk内使用了category,需要设置other linker flag为 -ObjC |
| 24 | 24 | ||
| 25 | 25 | ||
| 26 | ### 3、增加必要配置 | 26 | ### 3、增加必要配置 |
| 27 | 1)在application delegate中, 在application:openURL:sourceApplication:annotation:添加返回: | 27 | 1)在application delegate中, 在application:openURL:sourceApplication:annotation:添加返回: |
| 28 | 28 | ||
| 29 | return [[LetsGameAPI instance] handleOpenURL:url sourceApplication:sourceApplication]; | 29 | return [[LetsGameAPI instance] handleOpenURL:url sourceApplication:sourceApplication]; |
| 30 | 30 | ||
| 31 | 31 | ||
| 32 | 2)配置URL-schema(vk专用,不接入vk可忽略) | 32 | 2)配置URL-schema(vk专用,不接入vk可忽略) |
| 33 | 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 | 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. |
| 34 |  | 34 |  |
| 35 | Xcode 4: Open your Info.plist then add a new row URL Types. Set the URL identifier to vk+APP_ID | 35 | Xcode 4: Open your Info.plist then add a new row URL Types. Set the URL identifier to vk+APP_ID |
| 36 |  | 36 |  |
| 37 | 3)配置URL-schema(weChat专用,不接入可以忽略) | 37 | 3)配置URL-schema(weChat专用,不接入可以忽略) |
| 38 | 选中“TARGETS”一栏,在“info”标签栏的“URL type“添加“URL scheme”为你所注册的应用程序id | 38 | 选中“TARGETS”一栏,在“info”标签栏的“URL type“添加“URL scheme”为你所注册的应用程序id |
| 39 | 选中“TARGETS”一栏,在“info”标签栏的“LSApplicationQueriesSchemes“添加weixin和wechat | 39 | 选中“TARGETS”一栏,在“info”标签栏的“LSApplicationQueriesSchemes“添加weixin和wechat |
| 40 | 40 | ||
| 41 | ### 4、在工程里添加SDK登录代码 | 41 | ### 4、在工程里添加SDK登录代码 |
| 42 | 42 | ||
| 43 | [LetsGameAPI instance].appId = @"100"; // 设置appId | 43 | [LetsGameAPI instance].appId = @"100"; // 设置appId |
| 44 | [LetsGameAPI instance].appKey = @"100"; // 设置appKey | 44 | [LetsGameAPI instance].appKey = @"100"; // 设置appKey |
| 45 | [LetsGameAPI instance].channelId = @"100"; //设置channelId | 45 | [LetsGameAPI instance].channelId = @"100"; //设置channelId |
| 46 | 46 | ||
| 47 | //启用vk的代码,需要填入vk appId,若不接入vk,可以忽略 | 47 | //启用vk的代码,需要填入vk appId,若不接入vk,可以忽略 |
| 48 | //VKBridge *vkBridge = [[VKBridge alloc] initWithVKAppId:@"5029792"]; | 48 | //VKBridge *vkBridge = [[VKBridge alloc] initWithVKAppId:@"5029792"]; |
| 49 | //[LetsGameAPI instance].vkBridge = vkBridge; | 49 | //[LetsGameAPI instance].vkBridge = vkBridge; |
| 50 | 50 | ||
| 51 | //隐藏fb登录 | 51 | //隐藏fb登录 |
| 52 | [LetsGameAPI disableFB:YES]; | 52 | [LetsGameAPI disableFB:YES]; |
| 53 | //隐藏Google登录 | 53 | //隐藏Google登录 |
| 54 | [LetsGameAPI disableGoogle:YES]; | 54 | [LetsGameAPI disableGoogle:YES]; |
| 55 | //隐藏gumptech的logo | 55 | //隐藏gumptech的logo |
| 56 | [LetsGameAPI hiddenLogo:YES]; | 56 | [LetsGameAPI hiddenLogo:YES]; |
| 57 | //隐藏line登录 | 57 | //隐藏line登录 |
| 58 | [LetsGameAPI disableLine:YES]; | 58 | [LetsGameAPI disableLine:YES]; |
| 59 | //隐藏wechat登录 | 59 | //隐藏wechat登录 |
| 60 | [LetsGameAPI disableWeChat:YES]; | 60 | [LetsGameAPI disableWeChat:YES]; |
| 61 | 61 | ||
| 62 | [[LetsGameAPI instance] showLoginView]; // 弹出登录页面 | 62 | [[LetsGameAPI instance] showLoginView]; // 弹出登录页面 |
| 63 | 63 | ||
| 64 | // 登录成功回调 | 64 | // 登录成功回调 |
| 65 | [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) { | 65 | [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) { |
| 66 | NSLog(@"%@", [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %d", userId, sessionKey, type]); | 66 | NSLog(@"%@", [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %d", userId, sessionKey, type]); |
| 67 | }; | 67 | }; |
| 68 | 68 | ||
| 69 | // 登录失败回调 | 69 | // 登录失败回调,需要游戏自己处理 |
| 70 | [LetsGameAPI instance].dismissBlock = ^() { | 70 | [LetsGameAPI instance].dismissBlock = ^() { |
| 71 | NSLog(@"dismiss without login"); | 71 | NSLog(@"dismiss without login"); |
| 72 | }; | 72 | }; |
| 73 | 73 | ||
| 74 | ### 5、登录注销 | 74 | ### 5、登录注销 |
| 75 | 注销接口只要设置过appId和appKey之后就不需要设置了,注销完成之后会回到登录界面。FB登录回到登录页面,Gump登录或者游客登录回到登录框。 | 75 | 注销接口只要设置过appId和appKey之后就不需要设置了,注销完成之后会回到登录界面。FB登录回到登录页面,Gump登录或者游客登录回到登录框。 |
| 76 | 76 | ||
| 77 | [LetsGameAPI instance].appId = @"100";//设置appId | 77 | [LetsGameAPI instance].appId = @"100";//设置appId |
| 78 | [LetsGameAPI instance].appKey = @"100";//设置appkey | 78 | [LetsGameAPI instance].appKey = @"100";//设置appkey |
| 79 | [[LetsGameAPI instance] logout]; //注销 | 79 | [[LetsGameAPI instance] logout]; //注销 |
| 80 | 80 | ||
| 81 | 81 | ||
| 82 | ### 6、第三方支付 | 82 | ### 6、第三方支付 |
| 83 | [LetsGameAPI instance].appId = @"10022"; | 83 | [LetsGameAPI instance].appId = @"10022"; |
| 84 | [LetsGameAPI instance].appKey = @"f899139df5e1059396431415e770c6dd"; | 84 | [LetsGameAPI instance].appKey = @"f899139df5e1059396431415e770c6dd"; |
| 85 | NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; | 85 | NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; |
| 86 | [payInfo setValue:@"5001" forKey:@"serverId"];//服务器id,必传参数 | 86 | [payInfo setValue:@"5001" forKey:@"serverId"];//服务器id,必传参数 |
| 87 | [payInfo setValue:@"10010" forKey:@"roleId"];//用户角色id | 87 | [payInfo setValue:@"10010" forKey:@"roleId"];//用户角色id |
| 88 | [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id | 88 | [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id |
| 89 | [payInfo setValue:@"10" forKey:@"amount"];//金额 | 89 | [payInfo setValue:@"10" forKey:@"amount"];//金额 |
| 90 | [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//外部订单信息 | 90 | [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//外部订单信息 |
| 91 | [payInfo setValue:@"元宝" forKey:@"product"];//物品信息 | 91 | [payInfo setValue:@"元宝" forKey:@"product"];//物品信息 |
| 92 | [payInfo setValue:self.sessionKey forKey:@"sessionKey"];//登录成功的sessionKey | 92 | [payInfo setValue:self.sessionKey forKey:@"sessionKey"];//登录成功的sessionKey |
| 93 | [[LetsGameAPI instance] pWeb:payInfo handleCallBack:^{ | 93 | [[LetsGameAPI instance] pWeb:payInfo handleCallBack:^{ |
| 94 | //第三方支付完成时的回调(包括支付成功和支付失败,除了支付过程中取消的),取消的不会有回调 | 94 | //第三方支付完成时的回调(包括支付成功和支付失败,除了支付过程中取消的),取消的不会有回调 |
| 95 | NSLog(@"第三方支付完成"); | 95 | NSLog(@"第三方支付完成"); |
| 96 | }]]; | 96 | }]]; |
| 97 | 97 | ||
| 98 | ### 7、IAP支付 | 98 | ### 7、IAP支付 |
| 99 | 若要使用apple IAP支付,需要在AppDelegate的application: didFinishLaunchingWithOptions:方法内注册iap observer,使用如下方法 | 99 | 若要使用apple IAP支付,需要在AppDelegate的application: didFinishLaunchingWithOptions:方法内注册iap observer,使用如下方法 |
| 100 | 100 | ||
| 101 | [[LetsGameAPI instance] registeIapObserver]; | 101 | [[LetsGameAPI instance] registeIapObserver]; |
| 102 | 具体调用iap支付的方法如下: | 102 | 具体调用iap支付的方法如下: |
| 103 | 103 | ||
| 104 | [LetsGameAPI instance].appId = @"10022"; | 104 | [LetsGameAPI instance].appId = @"10022"; |
| 105 | [LetsGameAPI instance].appKey = @"93a27b0bd99bac3e68a440b48aa421ab"; | 105 | [LetsGameAPI instance].appKey = @"93a27b0bd99bac3e68a440b48aa421ab"; |
| 106 | NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; | 106 | NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; |
| 107 | [payInfo setValue:@"5001" forKey:@"serverId"];//当前用户所在的服务器Id | 107 | [payInfo setValue:@"5001" forKey:@"serverId"];//当前用户所在的服务器Id |
| 108 | [payInfo setValue:@"10010" forKey:@"roleId"];//当前用户的角色id | 108 | [payInfo setValue:@"10010" forKey:@"roleId"];//当前用户的角色id |
| 109 | [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id,用于统计 | 109 | [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id,用于统计 |
| 110 | [payInfo setValue:@"10" forKey:@"amount"];//对应支付项的支付金额,实际支付金额以itunes配置为准 | 110 | [payInfo setValue:@"10" forKey:@"amount"];//对应支付项的支付金额,实际支付金额以itunes配置为准 |
| 111 | [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//扩展信息,可以游戏自定义,建议传自有订单号 | 111 | [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//扩展信息,可以游戏自定义,建议传自有订单号 |
| 112 | [payInfo setValue:@"test.product.1" forKey:@"product"];//itunes 后台配置的对应支付项的productId | 112 | [payInfo setValue:@"test.product.1" forKey:@"product"];//itunes 后台配置的对应支付项的productId |
| 113 | [[LetsGameAPI instance] iap:payInfo forUser:@"" succCallback:^(NSString *orderId) { | 113 | [[LetsGameAPI instance] iap:payInfo forUser:@"" succCallback:^(NSString *orderId) { |
| 114 | //此处的回调表明支付已经完成,但此时支付不一定成功,需要服务端验证支付结果 | 114 | //此处的回调表明支付已经完成,但此时支付不一定成功,需要服务端验证支付结果 |
| 115 | //orderId为gump生成的订单号,此订单号可以在gump server查询此笔支付是否成功 | 115 | //orderId为gump生成的订单号,此订单号可以在gump server查询此笔支付是否成功 |
| 116 | NSLog(@"IAP completed orderId of Gumptech:%@",orderId); | 116 | NSLog(@"IAP completed orderId of Gumptech:%@",orderId); |
| 117 | } failCallback:^(NSString *orderId) { | 117 | } failCallback:^(NSString *orderId) { |
| 118 | //支付失败 | 118 | //支付失败 |
| 119 | NSLog(@"IAP file orderId of Gumptech:%@",orderId); | 119 | NSLog(@"IAP file orderId of Gumptech:%@",orderId); |
| 120 | }]; | 120 | }]; |
| 121 | ### 8、token的获取 | 121 | ### 8、token的获取 |
| 122 | FB登录之后会产生token并自动登录,需要如果需要token的话,需要自己调用接口获取。 | 122 | FB登录之后会产生token并自动登录,需要如果需要token的话,需要自己调用接口获取。 |
| 123 | 123 | ||
| 124 | //tokenString:token字符串 | 124 | //tokenString:token字符串 |
| 125 | //refreshTime:refreshTime token最后刷新的时间,即获取的token的时间 | 125 | //refreshTime:refreshTime token最后刷新的时间,即获取的token的时间 |
| 126 | //expirationTime:expirationTime token最后的有效时间 | 126 | //expirationTime:expirationTime token最后的有效时间 |
| 127 | [[LetsGameAPI instance] obtainAccessTokenSuccess:^(NSString *tokenString, NSString *refreshTime, NSString *expirationTime) { | 127 | [[LetsGameAPI instance] obtainAccessTokenSuccess:^(NSString *tokenString, NSString *refreshTime, NSString *expirationTime) { |
| 128 | NSLog(@"tokenString %@, refreshTime %@, expirationTime %@", tokenString, refreshTime, expirationTime); | 128 | NSLog(@"tokenString %@, refreshTime %@, expirationTime %@", tokenString, refreshTime, expirationTime); |
| 129 | } failure:^(NSString *errorString) { | 129 | } failure:^(NSString *errorString) { |
| 130 | NSLog(@"get token faile"); | 130 | NSLog(@"get token faile"); |
| 131 | }]; | 131 | }]; |
| 132 | 132 | ||
| 133 | 133 | ||
| 134 | ### 9、第三方支付版本 | 134 | ### 9、第三方支付版本 |
| 135 | 第三方支付,分成两个版本:没有gump币和有gump币,不设置时默认为不带gump币版本,如果使用带gump币的版本如下设置: | 135 | 第三方支付,分成两个版本:没有gump币和有gump币,不设置时默认为不带gump币版本,如果使用带gump币的版本如下设置: |
| 136 | 136 | ||
| 137 | 需要在 application:didFinishLaunchingWithOptions方法中添加: | 137 | 需要在 application:didFinishLaunchingWithOptions方法中添加: |
| 138 | 138 | ||
| 139 | [[LetsGameAPI instance] decideWebToVersion:1] | 139 | [[LetsGameAPI instance] decideWebToVersion:1] |
| 140 | 140 | ||
| 141 | 141 | ||
| 142 | ### 10、关于侵权还是侵权的接口显示 | 142 | ### 10、关于侵权还是侵权的接口显示 |
| 143 | 运营在后台配置此包名和版本在什么时候显示侵权内容还是不侵权内容,此接口调用需要在游戏才开始加载的时候调用,返回值是YES的时候显示侵权内容,在NO的时候显示不侵权内容。 | 143 | 运营在后台配置此包名和版本在什么时候显示侵权内容还是不侵权内容,此接口调用需要在游戏才开始加载的时候调用,返回值是YES的时候显示侵权内容,在NO的时候显示不侵权内容。 |
| 144 | 144 | ||
| 145 | 注意:关于运营配置的游戏的版本号,我们默认取的是Bulid版本号的值,请注意。 | 145 | 注意:关于运营配置的游戏的版本号,我们默认取的是Bulid版本号的值,请注意。 |
| 146 | 146 | ||
| 147 | [[LetsGameAPI instance] gameObtainSafeSetInfoWithAppId:@"10056" ChannelId:@"1000" handleCallBack:^(BOOL resultStatus) { | 147 | [[LetsGameAPI instance] gameObtainSafeSetInfoWithAppId:@"10056" ChannelId:@"1000" handleCallBack:^(BOOL resultStatus) { |
| 148 | if (resultStatus) { | 148 | if (resultStatus) { |
| 149 | NSLog(@"YES 侵权"); | 149 | NSLog(@"YES 侵权"); |
| 150 | }else{ | 150 | }else{ |
| 151 | NSLog(@"NO 不侵权"); | 151 | NSLog(@"NO 不侵权"); |
| 152 | } | 152 | } |
| 153 | }]; | 153 | }]; |
| 154 | ### 11、横竖屏设置 | 154 | ### 11、横竖屏设置 |
| 155 | 155 | ||
| 156 | 首先设置SDK默认是横屏,在General->Deployment Info->Device Orientain下,只选择Landscape Left 和 Landscape Right,SDK的界面默认是横屏。 | 156 | 首先设置SDK默认是横屏,在General->Deployment Info->Device Orientain下,只选择Landscape Left 和 Landscape Right,SDK的界面默认是横屏。 |
| 157 | 其次如果想使用竖屏的模式,需要在General->Deployment Info->Device Orientain下,只选择Portrait模式,并且需要在AppDelegate中的方法: | 157 | 其次如果想使用竖屏的模式,需要在General->Deployment Info->Device Orientain下,只选择Portrait模式,并且需要在AppDelegate中的方法: |
| 158 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;靠前的位置添加代码设置: | 158 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;靠前的位置添加代码设置: |
| 159 | 159 | ||
| 160 | [LetsGameAPI DeviceOrientationIsHorizontal:NO]; | 160 | [LetsGameAPI DeviceOrientationIsHorizontal:NO]; |
| 161 | 161 | ||
| 162 | 162 | ||
| 163 | 163 | ||
| 164 | 164 | ||
| 165 | 165 | ||
| 166 | ### 12、微信登陆 | 166 | ### 12、微信登陆 |
| 167 | 167 | ||
| 168 | 首先在- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;方法中向微信注册应用 | 168 | 首先在- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;方法中向微信注册应用 |
| 169 | //微信登陆 | 169 | //微信登陆 |
| 170 | [[LetsGameAPI instance] registerAppWeChatWithAppId:@"appId" appKey:@"appKey" Success:^{ | 170 | [[LetsGameAPI instance] registerAppWeChatWithAppId:@"appId" appKey:@"appKey" Success:^{ |
| 171 | NSLog(@"注册成功"); | 171 | NSLog(@"注册成功"); |
| 172 | } failure:^{ | 172 | } failure:^{ |
| 173 | NSLog(@"注册失败"); | 173 | NSLog(@"注册失败"); |
| 174 | }]; | 174 | }]; |
| 175 | 175 | ||
| 176 | 176 | ||
| 177 | ### 13、CocoaPods集成 | 177 | ### 13、CocoaPods集成 |
| 178 | 集成项目的.framework和bundle,但是vk登录封装的VK.framework,需要自己手动添加。 | 178 | 集成项目的.framework和bundle,但是vk登录封装的VK.framework,需要自己手动添加。 |
| 179 | ``` | 179 | ``` |
| 180 | pod 'GameSDK', '~> 3.5.5' | 180 | pod 'GameSDK', '~> 3.5.5' |
| 181 | ``` | 181 | ``` |
| 182 | 182 | ||
| 183 | ### 14、活动添加 | 183 | ### 14、活动添加 |
| 184 | 添加项目GameActivitySDK.framework | 184 | 添加项目GameActivitySDK.framework |
| 185 | 设置:设置xxxx.plist | 185 | 设置:设置xxxx.plist |
| 186 | 只支持HTTP的方式,需要将相应的项目的xxx.plist添加Information Property List->App Transport Security Settings -> Allow Arbitrary Loads设置为YES | 186 | 只支持HTTP的方式,需要将相应的项目的xxx.plist添加Information Property List->App Transport Security Settings -> Allow Arbitrary Loads设置为YES |
| 187 | 187 | ||
| 188 | 工程中添加SDK登录代码: | 188 | 工程中添加SDK登录代码: |
| 189 | 189 | ||
| 190 | NSMutableDictionary *activityInfo = [NSMutableDictionary dictionary]; | 190 | NSMutableDictionary *activityInfo = [NSMutableDictionary dictionary]; |
| 191 | [activityInfo setValue:@"100" forKey:@"appId"]; | 191 | [activityInfo setValue:@"100" forKey:@"appId"]; |
| 192 | [activityInfo setValue:@"f899139df5e1059396431415e770c6dd" forKey:@"appKey"]; | 192 | [activityInfo setValue:@"f899139df5e1059396431415e770c6dd" forKey:@"appKey"]; |
| 193 | [activityInfo setValue:@"123456" forKey:@"userId"]; | 193 | [activityInfo setValue:@"123456" forKey:@"userId"]; |
| 194 | [activityInfo setValue:@"111" forKey:@"serverId"]; | 194 | [activityInfo setValue:@"111" forKey:@"serverId"]; |
| 195 | [activityInfo setValue:@"aaa" forKey:@"serverName"]; | 195 | [activityInfo setValue:@"aaa" forKey:@"serverName"]; |
| 196 | [activityInfo setValue:@"222" forKey:@"roleId"]; | 196 | [activityInfo setValue:@"222" forKey:@"roleId"]; |
| 197 | [activityInfo setValue:@"ccc" forKey:@"roleName"]; | 197 | [activityInfo setValue:@"ccc" forKey:@"roleName"]; |
| 198 | [activityInfo setValue:@"888" forKey:@"diamond"]; | 198 | [activityInfo setValue:@"888" forKey:@"diamond"]; |
| 199 | //活动关闭的回调 | 199 | //活动关闭的回调 |
| 200 | [[LetsGameActivityAPI instance] GameActivityWithParaDictory:activityInfo handleCallBackL:^{ | 200 | [[LetsGameActivityAPI instance] GameActivityWithParaDictory:activityInfo handleCallBackL:^{ |
| 201 | NSLog(@"activity finish!"); | 201 | NSLog(@"activity finish!"); |
| 202 | }]; | 202 | }]; |
| 203 | 203 |
ios/GameSDKDemo/GameSDKDemo.xcodeproj/project.xcworkspace/xcuserdata/yanglele.xcuserdatad/UserInterfaceState.xcuserstate
No preview for this file type
ios/GameSDKDemo/letsgameDemo/LSGMainViewController.m
| 1 | // | 1 | // |
| 2 | // LSGMainViewController.m | 2 | // LSGMainViewController.m |
| 3 | // letsgameDemo | 3 | // letsgameDemo |
| 4 | // | 4 | // |
| 5 | // Created by zhy on 14-5-24. | 5 | // Created by zhy on 14-5-24. |
| 6 | // | 6 | // |
| 7 | // | 7 | // |
| 8 | 8 | ||
| 9 | #import "LSGMainViewController.h" | 9 | #import "LSGMainViewController.h" |
| 10 | #import "LetsGameAPI.h" | 10 | #import "LetsGameAPI.h" |
| 11 | #import "LetsGameActivityAPI.h" | 11 | #import "LetsGameActivityAPI.h" |
| 12 | #import "VKBridge.h" | 12 | #import "VKBridge.h" |
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | @interface LSGMainViewController () | 15 | @interface LSGMainViewController () |
| 16 | 16 | ||
| 17 | @property (nonatomic, strong) UILabel *resultLabel; | 17 | @property (nonatomic, strong) UILabel *resultLabel; |
| 18 | 18 | ||
| 19 | @property(nonatomic,strong) UIButton *vkActivityShareBtn; | 19 | @property(nonatomic,strong) UIButton *vkActivityShareBtn; |
| 20 | 20 | ||
| 21 | @property(nonatomic,copy) NSString *sessionKey; | 21 | @property(nonatomic,copy) NSString *sessionKey; |
| 22 | @end | 22 | @end |
| 23 | 23 | ||
| 24 | @implementation LSGMainViewController | 24 | @implementation LSGMainViewController |
| 25 | 25 | ||
| 26 | - (void)loadView { | 26 | - (void)loadView { |
| 27 | [super loadView]; | 27 | [super loadView]; |
| 28 | NSLog(@"i come in"); | 28 | NSLog(@"i come in"); |
| 29 | self.view.backgroundColor = [UIColor whiteColor]; | 29 | self.view.backgroundColor = [UIColor whiteColor]; |
| 30 | // self.view.backgroundColor = [UIColor blackColor]; | 30 | // self.view.backgroundColor = [UIColor blackColor]; |
| 31 | 31 | ||
| 32 | UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(110, 40, 100, 30)]; | 32 | UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(110, 40, 100, 30)]; |
| 33 | btn.backgroundColor = [UIColor orangeColor]; | 33 | btn.backgroundColor = [UIColor orangeColor]; |
| 34 | [btn setTitle:@"测试入口" forState:UIControlStateNormal]; | 34 | [btn setTitle:@"测试入口" forState:UIControlStateNormal]; |
| 35 | [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; | 35 | [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; |
| 36 | btn.titleLabel.font = [UIFont systemFontOfSize:15]; | 36 | btn.titleLabel.font = [UIFont systemFontOfSize:15]; |
| 37 | [btn addTarget:self action:@selector(onClickTest) forControlEvents:UIControlEventTouchUpInside]; | 37 | [btn addTarget:self action:@selector(onClickTest) forControlEvents:UIControlEventTouchUpInside]; |
| 38 | [self.view addSubview:btn]; | 38 | [self.view addSubview:btn]; |
| 39 | 39 | ||
| 40 | 40 | ||
| 41 | 41 | ||
| 42 | UIButton *bindtn = [[UIButton alloc] initWithFrame:CGRectMake(110, 100, 100, 30)]; | 42 | UIButton *bindtn = [[UIButton alloc] initWithFrame:CGRectMake(110, 100, 100, 30)]; |
| 43 | bindtn.backgroundColor = [UIColor orangeColor]; | 43 | bindtn.backgroundColor = [UIColor orangeColor]; |
| 44 | [bindtn setTitle:@"退出账号" forState:UIControlStateNormal]; | 44 | [bindtn setTitle:@"退出账号" forState:UIControlStateNormal]; |
| 45 | [bindtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; | 45 | [bindtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; |
| 46 | bindtn.titleLabel.font = [UIFont systemFontOfSize:15]; | 46 | bindtn.titleLabel.font = [UIFont systemFontOfSize:15]; |
| 47 | [bindtn addTarget:self action:@selector(onLogoutTest) forControlEvents:UIControlEventTouchUpInside]; | 47 | [bindtn addTarget:self action:@selector(onLogoutTest) forControlEvents:UIControlEventTouchUpInside]; |
| 48 | [self.view addSubview:bindtn]; | 48 | [self.view addSubview:bindtn]; |
| 49 | 49 | ||
| 50 | UIButton *payBtn = [[UIButton alloc] initWithFrame:CGRectMake(110, 160, 100, 30)]; | 50 | UIButton *payBtn = [[UIButton alloc] initWithFrame:CGRectMake(110, 160, 100, 30)]; |
| 51 | payBtn.backgroundColor = [UIColor orangeColor]; | 51 | payBtn.backgroundColor = [UIColor orangeColor]; |
| 52 | [payBtn setTitle:@"支付" forState:UIControlStateNormal]; | 52 | [payBtn setTitle:@"支付" forState:UIControlStateNormal]; |
| 53 | [payBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; | 53 | [payBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; |
| 54 | payBtn.titleLabel.font = [UIFont systemFontOfSize:15]; | 54 | payBtn.titleLabel.font = [UIFont systemFontOfSize:15]; |
| 55 | [payBtn addTarget:self action:@selector(onPayTest) forControlEvents:UIControlEventTouchUpInside]; | 55 | [payBtn addTarget:self action:@selector(onPayTest) forControlEvents:UIControlEventTouchUpInside]; |
| 56 | [self.view addSubview:payBtn]; | 56 | [self.view addSubview:payBtn]; |
| 57 | 57 | ||
| 58 | UIButton *iapBtn = [[UIButton alloc] initWithFrame:CGRectMake(110, 220, 100, 30)]; | 58 | UIButton *iapBtn = [[UIButton alloc] initWithFrame:CGRectMake(110, 220, 100, 30)]; |
| 59 | iapBtn.backgroundColor = [UIColor orangeColor]; | 59 | iapBtn.backgroundColor = [UIColor orangeColor]; |
| 60 | [iapBtn setTitle:@"IAP" forState:UIControlStateNormal]; | 60 | [iapBtn setTitle:@"IAP" forState:UIControlStateNormal]; |
| 61 | [iapBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; | 61 | [iapBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; |
| 62 | iapBtn.titleLabel.font = [UIFont systemFontOfSize:15]; | 62 | iapBtn.titleLabel.font = [UIFont systemFontOfSize:15]; |
| 63 | [iapBtn addTarget:self action:@selector(onIapTest) forControlEvents:UIControlEventTouchUpInside]; | 63 | [iapBtn addTarget:self action:@selector(onIapTest) forControlEvents:UIControlEventTouchUpInside]; |
| 64 | [self.view addSubview:iapBtn]; | 64 | [self.view addSubview:iapBtn]; |
| 65 | 65 | ||
| 66 | UIButton *activityBtn = [[UIButton alloc] initWithFrame:CGRectMake(110, 320, 100, 30)]; | 66 | UIButton *activityBtn = [[UIButton alloc] initWithFrame:CGRectMake(110, 320, 100, 30)]; |
| 67 | activityBtn.backgroundColor = [UIColor orangeColor]; | 67 | activityBtn.backgroundColor = [UIColor orangeColor]; |
| 68 | [activityBtn setTitle:@"Activity" forState:UIControlStateNormal]; | 68 | [activityBtn setTitle:@"Activity" forState:UIControlStateNormal]; |
| 69 | [activityBtn setTintColor:[UIColor whiteColor]]; | 69 | [activityBtn setTintColor:[UIColor whiteColor]]; |
| 70 | activityBtn.titleLabel.font = [UIFont systemFontOfSize:15]; | 70 | activityBtn.titleLabel.font = [UIFont systemFontOfSize:15]; |
| 71 | [activityBtn addTarget:self action:@selector(onActivity) forControlEvents:UIControlEventTouchUpInside]; | 71 | [activityBtn addTarget:self action:@selector(onActivity) forControlEvents:UIControlEventTouchUpInside]; |
| 72 | [self.view addSubview:activityBtn]; | 72 | [self.view addSubview:activityBtn]; |
| 73 | 73 | ||
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | - (UILabel *)resultLabel { | 76 | - (UILabel *)resultLabel { |
| 77 | if (!_resultLabel) { | 77 | if (!_resultLabel) { |
| 78 | _resultLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.view.frame) - 90, self.view.frame.size.width, 60)]; | 78 | _resultLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.view.frame) - 90, self.view.frame.size.width, 60)]; |
| 79 | _resultLabel.backgroundColor = [UIColor clearColor]; | 79 | _resultLabel.backgroundColor = [UIColor clearColor]; |
| 80 | _resultLabel.textAlignment = NSTextAlignmentCenter; | 80 | _resultLabel.textAlignment = NSTextAlignmentCenter; |
| 81 | _resultLabel.textColor = [UIColor redColor]; | 81 | _resultLabel.textColor = [UIColor redColor]; |
| 82 | _resultLabel.font = [UIFont systemFontOfSize:15]; | 82 | _resultLabel.font = [UIFont systemFontOfSize:15]; |
| 83 | _resultLabel.numberOfLines = 4; | 83 | _resultLabel.numberOfLines = 4; |
| 84 | _resultLabel.lineBreakMode = NSLineBreakByWordWrapping; | 84 | _resultLabel.lineBreakMode = NSLineBreakByWordWrapping; |
| 85 | [self.view addSubview:_resultLabel]; | 85 | [self.view addSubview:_resultLabel]; |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | return _resultLabel; | 88 | return _resultLabel; |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | 91 | ||
| 92 | - (void)onClickTest { | 92 | - (void)onClickTest { |
| 93 | 93 | ||
| 94 | [LetsGameAPI instance].appId = @"10105";//@"100";//10047 | 94 | [LetsGameAPI instance].appId = @"10105";//@"100";//10047 |
| 95 | [LetsGameAPI instance].appKey = @"4c0a7bdd46ceb88d497eec5de360328e";//@"f899139df5e1059396431415e770c6dd";//eccd9f7dc92858b741132fda313130cf | 95 | [LetsGameAPI instance].appKey = @"4c0a7bdd46ceb88d497eec5de360328e";//@"f899139df5e1059396431415e770c6dd";//eccd9f7dc92858b741132fda313130cf |
| 96 | [LetsGameAPI instance].channelId = @"1000"; | 96 | [LetsGameAPI instance].channelId = @"1000"; |
| 97 | [LetsGameAPI hiddenLogo:YES]; | 97 | [LetsGameAPI hiddenLogo:YES]; |
| 98 | // [LetsGameAPI disableFB:YES]; | 98 | // [LetsGameAPI disableFB:YES]; |
| 99 | // [LetsGameAPI disableGoogle:YES]; | 99 | // [LetsGameAPI disableGoogle:YES]; |
| 100 | // [LetsGameAPI disableLine:YES]; | 100 | // [LetsGameAPI disableLine:YES]; |
| 101 | // [LetsGameAPI disableWeChat:YES]; | 101 | // [LetsGameAPI disableWeChat:YES]; |
| 102 | NSLog(@"sdk version:%@",[[LetsGameAPI instance] version]); | 102 | NSLog(@"sdk version:%@",[[LetsGameAPI instance] version]); |
| 103 | //启用vk登录 | 103 | //启用vk登录 |
| 104 | VKBridge *vkBridge = [[VKBridge alloc] initWithVKAppId:@"5029792"]; | 104 | VKBridge *vkBridge = [[VKBridge alloc] initWithVKAppId:@"5029792"]; |
| 105 | [LetsGameAPI instance].vkBridge = vkBridge; | 105 | [LetsGameAPI instance].vkBridge = vkBridge; |
| 106 | 106 | ||
| 107 | [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) { | 107 | [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) { |
| 108 | self.sessionKey = sessionKey; | 108 | self.sessionKey = sessionKey; |
| 109 | self.resultLabel.text = [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %ld", userId, sessionKey, type]; | 109 | self.resultLabel.text = [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %ld", userId, sessionKey, type]; |
| 110 | }; | 110 | }; |
| 111 | [LetsGameAPI instance].dismissBlock = ^() { | 111 | [LetsGameAPI instance].dismissBlock = ^() { |
| 112 | //登录失败操作 | ||
| 112 | self.resultLabel.text = @"dismiss without login"; | 113 | self.resultLabel.text = @"dismiss without login"; |
| 113 | }; | 114 | }; |
| 114 | 115 | ||
| 115 | [[LetsGameAPI instance] showLoginView]; | 116 | [[LetsGameAPI instance] showLoginView]; |
| 116 | } | 117 | } |
| 117 | 118 | ||
| 118 | 119 | ||
| 119 | - (void)onLogoutTest { | 120 | - (void)onLogoutTest { |
| 120 | [LetsGameAPI instance].appId = @"10056"; | 121 | [LetsGameAPI instance].appId = @"10056"; |
| 121 | [LetsGameAPI instance].appKey = @"b59c21a078fde074a6750e91ed19fb21"; | 122 | [LetsGameAPI instance].appKey = @"b59c21a078fde074a6750e91ed19fb21"; |
| 122 | [[LetsGameAPI instance] logout]; | 123 | [[LetsGameAPI instance] logout]; |
| 123 | 124 | ||
| 124 | } | 125 | } |
| 125 | 126 | ||
| 126 | -(void)onPayTest{ | 127 | -(void)onPayTest{ |
| 127 | [LetsGameAPI instance].appId = @"10103";//@"10056";//10022 | 128 | [LetsGameAPI instance].appId = @"10103";//@"10056";//10022 |
| 128 | [LetsGameAPI instance].appKey = @"f53eb4122d5e2ce81a12093f8f9ce922";//@"b59c21a078fde074a6750e91ed19fb21";//93a27b0bd99bac3e68a440b48aa421ab | 129 | [LetsGameAPI instance].appKey = @"f53eb4122d5e2ce81a12093f8f9ce922";//@"b59c21a078fde074a6750e91ed19fb21";//93a27b0bd99bac3e68a440b48aa421ab |
| 129 | NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; | 130 | NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; |
| 130 | [payInfo setValue:@"s1" forKey:@"serverId"]; | 131 | [payInfo setValue:@"s1" forKey:@"serverId"]; |
| 131 | [payInfo setValue:@"556553" forKey:@"roleId"]; | 132 | [payInfo setValue:@"556553" forKey:@"roleId"]; |
| 132 | [payInfo setValue:@"1002" forKey:@"channelId"]; | 133 | [payInfo setValue:@"1002" forKey:@"channelId"]; |
| 133 | [payInfo setValue:@"10" forKey:@"amount"]; | 134 | [payInfo setValue:@"10" forKey:@"amount"]; |
| 134 | [payInfo setValue:@"ios demo" forKey:@"extraInfo"]; | 135 | [payInfo setValue:@"ios demo" forKey:@"extraInfo"]; |
| 135 | [payInfo setValue:@"wa2" forKey:@"product"]; | 136 | [payInfo setValue:@"wa2" forKey:@"product"]; |
| 136 | [payInfo setValue:@"78b83666bd77c1e4c95442140672254d" forKey:@"sessionKey"]; //self.sessionKey | 137 | [payInfo setValue:@"78b83666bd77c1e4c95442140672254d" forKey:@"sessionKey"]; //self.sessionKey |
| 137 | // [[LetsGameAPI instance] pay:payInfo handleCallBack:^{ | 138 | // [[LetsGameAPI instance] pay:payInfo handleCallBack:^{ |
| 138 | // NSLog(@"第三方支付完成"); | 139 | // NSLog(@"第三方支付完成"); |
| 139 | // }]; | 140 | // }]; |
| 140 | [[LetsGameAPI instance] pWeb:payInfo handleCallBack:^{ | 141 | [[LetsGameAPI instance] pWeb:payInfo handleCallBack:^{ |
| 141 | NSLog(@"第三方支付完成"); | 142 | NSLog(@"第三方支付完成"); |
| 142 | }]; | 143 | }]; |
| 143 | } | 144 | } |
| 144 | 145 | ||
| 145 | -(void)onIapTest{ | 146 | -(void)onIapTest{ |
| 146 | 147 | ||
| 147 | [LetsGameAPI instance].appId = @"10056"; | 148 | [LetsGameAPI instance].appId = @"10056"; |
| 148 | [LetsGameAPI instance].appKey = @"b59c21a078fde074a6750e91ed19fb21"; | 149 | [LetsGameAPI instance].appKey = @"b59c21a078fde074a6750e91ed19fb21"; |
| 149 | NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; | 150 | NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; |
| 150 | [payInfo setValue:@"5001" forKey:@"serverId"]; | 151 | [payInfo setValue:@"5001" forKey:@"serverId"]; |
| 151 | [payInfo setValue:@"10010" forKey:@"roleId"]; | 152 | [payInfo setValue:@"10010" forKey:@"roleId"]; |
| 152 | [payInfo setValue:@"1000" forKey:@"channelId"]; | 153 | [payInfo setValue:@"1000" forKey:@"channelId"]; |
| 153 | [payInfo setValue:@"10" forKey:@"amount"]; | 154 | [payInfo setValue:@"10" forKey:@"amount"]; |
| 154 | [payInfo setValue:@"ios demo" forKey:@"extraInfo"]; | 155 | [payInfo setValue:@"ios demo" forKey:@"extraInfo"]; |
| 155 | [payInfo setValue:@"test.product.1" forKey:@"product"]; | 156 | [payInfo setValue:@"test.product.1" forKey:@"product"]; |
| 156 | [[LetsGameAPI instance] iap:payInfo forUser:@"" succCallback:^(NSString *orderId) { | 157 | [[LetsGameAPI instance] iap:payInfo forUser:@"" succCallback:^(NSString *orderId) { |
| 157 | //注意测试仅仅是通知客户端成功,但是还需要向服务器请求验证是否成功,以服务端验证为准 | 158 | //注意测试仅仅是通知客户端成功,但是还需要向服务器请求验证是否成功,以服务端验证为准 |
| 158 | NSLog(@"IAP completed orderId of Gumptech:%@",orderId); | 159 | NSLog(@"IAP completed orderId of Gumptech:%@",orderId); |
| 159 | } failCallback:^(NSString *orderId) { | 160 | } failCallback:^(NSString *orderId) { |
| 160 | NSLog(@"IAP file orderId of Gumptech:%@",orderId); | 161 | NSLog(@"IAP file orderId of Gumptech:%@",orderId); |
| 161 | }]; | 162 | }]; |
| 162 | } | 163 | } |
| 163 | 164 | ||
| 164 | -(void)onActivity{ | 165 | -(void)onActivity{ |
| 165 | 166 | ||
| 166 | [[LetsGameActivityAPI instance] decideIsDebug:1]; | 167 | [[LetsGameActivityAPI instance] decideIsDebug:1]; |
| 167 | // [LetsGameActivityAPI instance].supportLandscape = YES; | 168 | // [LetsGameActivityAPI instance].supportLandscape = YES; |
| 168 | // [[LetsGameActivityAPI instance] decideAllowRotate:1]; | 169 | // [[LetsGameActivityAPI instance] decideAllowRotate:1]; |
| 169 | NSMutableDictionary *activityInfo = [NSMutableDictionary dictionary]; | 170 | NSMutableDictionary *activityInfo = [NSMutableDictionary dictionary]; |
| 170 | [activityInfo setValue:@"100" forKey:@"appId"]; | 171 | [activityInfo setValue:@"100" forKey:@"appId"]; |
| 171 | [activityInfo setValue:@"f899139df5e1059396431415e770c6dd" forKey:@"appKey"]; | 172 | [activityInfo setValue:@"f899139df5e1059396431415e770c6dd" forKey:@"appKey"]; |
| 172 | [activityInfo setValue:@"123456" forKey:@"userId"]; | 173 | [activityInfo setValue:@"123456" forKey:@"userId"]; |
| 173 | [activityInfo setValue:@"111" forKey:@"serverId"]; | 174 | [activityInfo setValue:@"111" forKey:@"serverId"]; |
| 174 | [activityInfo setValue:@"aaa" forKey:@"serverName"]; | 175 | [activityInfo setValue:@"aaa" forKey:@"serverName"]; |
| 175 | [activityInfo setValue:@"222" forKey:@"roleId"]; | 176 | [activityInfo setValue:@"222" forKey:@"roleId"]; |
| 176 | [activityInfo setValue:@"ccc" forKey:@"roleName"]; | 177 | [activityInfo setValue:@"ccc" forKey:@"roleName"]; |
| 177 | [activityInfo setValue:@"888" forKey:@"diamond"]; | 178 | [activityInfo setValue:@"888" forKey:@"diamond"]; |
| 178 | [[LetsGameActivityAPI instance] GameActivityWithParaDictory:activityInfo handleCallBackL:^{ | 179 | [[LetsGameActivityAPI instance] GameActivityWithParaDictory:activityInfo handleCallBackL:^{ |
| 179 | NSLog(@"activity finish!"); | 180 | NSLog(@"activity finish!"); |
| 180 | }]; | 181 | }]; |
| 181 | } | 182 | } |
| 182 | 183 | ||
| 183 | 184 | ||
| 184 | 185 | ||
| 185 | @end | 186 | @end |
| 186 | 187 |
-
自动登录失败返回游戏