Commit 90dd3749f965212348e3b681f20b6f7d50a20fc4
1 parent
58aa87d07a
Exists in
master
login sdk
Showing 7 changed files with 4 additions and 142 deletions Side-by-side Diff
- IOSDocument.md
- README.md
- ios/GameSDK.zip
- ios/GameSDKDemo/GameSDKDemo.xcodeproj/project.pbxproj
- ios/GameSDKDemo/GameSDKDemo.xcodeproj/project.xcworkspace/xcuserdata/yanglele.xcuserdatad/UserInterfaceState.xcuserstate
- ios/GumpLoginSDK.framework/Versions/A/GumpLoginSDK
- ios/GumpLoginSDK.framework/Versions/A/Headers/GPGameLoginSDK.h
IOSDocument.md
README.md
| ... | ... | @@ -1,138 +0,0 @@ |
| 1 | -# Gump IOS SDK使用文档 | |
| 2 | - | |
| 3 | - | |
| 4 | -接入手册 | |
| 5 | -登陆sdk:GumpLoginSDK.framework v1.0.11 | |
| 6 | -支付sdk: GameSDK.framework v4.0.7 | |
| 7 | -2019年5月31日 | |
| 8 | - | |
| 9 | -## 概述 | |
| 10 | -#### 本SDK提供Game Center登陆 和 游客登陆两种账号登录,iap支付和第三方支付两种支付功能,活动SDK(大转盘等)。 | |
| 11 | - | |
| 12 | -## 接入步骤 | |
| 13 | -### 1、添加Framework和资源文件 | |
| 14 | -+ 以下为必须添加的framework以及资源bundle: | |
| 15 | -MobileCoreServices.framework、SystemConfiguration.framework、libz.dylib、CFNetwork.framework、GumpLoginSDK.framework、GameSDK.framework、GameActivitySDK.framework、StoreKit.framework、GameSDKResources.bundle | |
| 16 | - | |
| 17 | -### 2、引入头文件,设置build setting | |
| 18 | -因sdk内使用了category,需要设置other linker flag为 -ObjC | |
| 19 | - | |
| 20 | - | |
| 21 | -### 3、增加必要配置 | |
| 22 | -1)在application delegate中, 在application:openURL:sourceApplication:annotation:添加返回: | |
| 23 | - | |
| 24 | - return [[LetsGameAPI instance] handleOpenURL:url sourceApplication:sourceApplication]; | |
| 25 | - | |
| 26 | -2) 在工程的Targets->Capablities->Game Center 打开 | |
| 27 | - | |
| 28 | - | |
| 29 | -### 4、在工程里添加SDK登录代码 | |
| 30 | -添加GumpLoginSDK.framework | |
| 31 | - | |
| 32 | - | |
| 33 | - [[GPGameLoginSDK instance] GPGameLoginWithViewController:self appID:@"100" channelId:@"10002"]; | |
| 34 | - [GPGameLoginSDK instance].succBlock = ^(NSNumber *userId, ACCOUNTTYPE type) { | |
| 35 | - self.resultLabel.text = [NSString stringWithFormat:@"userId: %@, accountType: %ld", userId, (long)type]; | |
| 36 | - }; | |
| 37 | - [GPGameLoginSDK instance].failBlock = ^{ | |
| 38 | - self.resultLabel.text = @"login error"; | |
| 39 | - }; | |
| 40 | - | |
| 41 | - | |
| 42 | -### 5、第三方支付 | |
| 43 | - [LetsGameAPI instance].appId = @"10022"; | |
| 44 | - NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; | |
| 45 | - [payInfo setValue:@"5001" forKey:@"serverId"];//服务器id,必传参数 | |
| 46 | - [payInfo setValue:@"10010" forKey:@"roleId"];//用户角色id | |
| 47 | - [payInfo setValue:@"1595907" forKey:@"userId"];//用户ID userId | |
| 48 | - [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id | |
| 49 | - [payInfo setValue:@"10" forKey:@"amount"];//金额 | |
| 50 | - [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//外部订单信息 | |
| 51 | - [payInfo setValue:@"test1" forKey:@"product"];//商品ID | |
| 52 | - [[LetsGameAPI instance] pWeb:payInfo handleCallBack:^{ | |
| 53 | - //第三方支付完成时的回调(包括支付成功和支付失败,除了支付过程中取消的),取消的不会有回调 | |
| 54 | - NSLog(@"第三方支付完成"); | |
| 55 | - }]]; | |
| 56 | - | |
| 57 | -### 6、IAP支付 | |
| 58 | -若要使用apple IAP支付,需要在AppDelegate的application: didFinishLaunchingWithOptions:方法内注册iap observer,使用如下方法 | |
| 59 | - | |
| 60 | - [[LetsGameAPI instance] registeIapObserver]; | |
| 61 | -具体调用iap支付的方法如下: | |
| 62 | - | |
| 63 | - [LetsGameAPI instance].appId = @"100"; | |
| 64 | - NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; | |
| 65 | - [payInfo setValue:@"5001" forKey:@"serverId"];//当前用户所在的服务器Id | |
| 66 | - [payInfo setValue:@"10010" forKey:@"roleId"];//当前用户的角色id | |
| 67 | - [payInfo setValue:@"1595907" forKey:@"userId"];//用户ID userId | |
| 68 | - [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id,用于统计 | |
| 69 | - [payInfo setValue:@"10" forKey:@"amount"];//对应支付项的支付金额,实际支付金额以itunes配置为准 | |
| 70 | - [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//扩展信息,可以游戏自定义,建议传自有订单号 | |
| 71 | - [payInfo setValue:@"test.product.1" forKey:@"product"];//itunes 后台配置的对应支付项的productId | |
| 72 | - [[LetsGameAPI instance] iap:payInfo succCallback:^(NSString *orderId) { | |
| 73 | - //此处的回调表明支付已经完成,但此时支付不一定成功,需要服务端验证支付结果 | |
| 74 | - //orderId为gump生成的订单号,此订单号可以在gump server查询此笔支付是否成功 | |
| 75 | - NSLog(@"IAP completed orderId of Gumptech:%@",orderId); | |
| 76 | - } failCallback:^(NSString *orderId) { | |
| 77 | - //支付失败 | |
| 78 | - NSLog(@"IAP file orderId of Gumptech:%@",orderId); | |
| 79 | - }]; | |
| 80 | - | |
| 81 | - | |
| 82 | -### 7、第三方支付版本 | |
| 83 | -第三方支付,分成两个版本:没有gump币和有gump币,不设置时默认为不带gump币版本,如果使用带gump币的版本如下设置: | |
| 84 | - | |
| 85 | - 需要在 application:didFinishLaunchingWithOptions方法中添加: | |
| 86 | - | |
| 87 | - [[LetsGameAPI instance] decideWebToVersion:1] | |
| 88 | - | |
| 89 | -### 8、第三方支付横竖屏设置 | |
| 90 | -添加GameSDK.framework | |
| 91 | - 首先设置支付SDK默认是横屏,在General->Deployment Info->Device Orientain下,只选择Landscape Left 和 Landscape Right,SDK的界面默认是横屏。 | |
| 92 | - 其次如果想使用竖屏的模式,需要在General->Deployment Info->Device Orientain下,只选择Portrait模式,并且需要在AppDelegate中的方法: | |
| 93 | - - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;靠前的位置添加代码设置: | |
| 94 | - | |
| 95 | - [LetsGameAPI DeviceOrientationIsHorizontal:NO]; | |
| 96 | - | |
| 97 | -### 9、活动添加 | |
| 98 | -添加GameActivitySDK.framework | |
| 99 | -设置:设置xxxx.plist | |
| 100 | -只支持HTTP的方式,需要将相应的项目的xxx.plist添加Information Property List->App Transport Security Settings -> Allow Arbitrary Loads设置为YES | |
| 101 | - | |
| 102 | -工程中添加SDK登录代码: | |
| 103 | - | |
| 104 | - NSMutableDictionary *activityInfo = [NSMutableDictionary dictionary]; | |
| 105 | - [activityInfo setValue:@"100" forKey:@"appId"]; | |
| 106 | - [activityInfo setValue:@"123456" forKey:@"userId"]; | |
| 107 | - [activityInfo setValue:@"111" forKey:@"serverId"]; | |
| 108 | - [activityInfo setValue:@"aaa" forKey:@"serverName"]; | |
| 109 | - [activityInfo setValue:@"222" forKey:@"roleId"]; | |
| 110 | - [activityInfo setValue:@"ccc" forKey:@"roleName"]; | |
| 111 | - [activityInfo setValue:@"888" forKey:@"diamond"]; | |
| 112 | - //活动关闭的回调 | |
| 113 | - [[LetsGameActivityAPI instance] GameActivityWithParaDictory:activityInfo handleCallBackL:^{ | |
| 114 | - NSLog(@"activity finish!"); | |
| 115 | - }]; | |
| 116 | - | |
| 117 | -### 10、账号联动 | |
| 118 | -需要提供按钮绑定,点击事件调用下面方法。 | |
| 119 | -此功能涉及账号的绑定和切换,回调只有在切换成功之后才会出现,其他情况的回调都是失败的回调。 | |
| 120 | -工程中添加SDK账号联动代码: | |
| 121 | - | |
| 122 | - NSMutableDictionary *linkParaDic = [NSMutableDictionary dictionary]; | |
| 123 | - [linkParaDic setObject:@"10022" forKey:@"appId"]; | |
| 124 | - [linkParaDic setObject:self.userId forKey:@"userId"]; | |
| 125 | - //仅在切换账号成功的时候有返回值 | |
| 126 | - [[GPGameLoginSDK instance] GPGameAccountLinkViewController:self InfoDic:linkParaDic callBack:^(NSNumber *userId, ACCOUNTENTERTYPE type) { | |
| 127 | - self.resultLabel.text = [NSString stringWithFormat:@"userId: %@, accountType: %ld", userId, (long)type]; | |
| 128 | - }]; | |
| 129 | - | |
| 130 | -### 11、切换系统账号 | |
| 131 | -需要提供按钮切换系统账号,点击事件调用下面方法。 | |
| 132 | -需要用户自己去往Game Center切换账号,之后再次登陆游戏才能实现账号切换。 | |
| 133 | -工程中添加SDK切换系统账号代码: | |
| 134 | - | |
| 135 | - [[GPGameLoginSDK instance] GPSwitchGameCenterWithViewController:self switchCallBack:^{ | |
| 136 | - self.resultLabel.text = @"Login Game Center"; | |
| 137 | - }]; | |
| 138 | - |
ios/GameSDK.zip
No preview for this file type
ios/GameSDKDemo/GameSDKDemo.xcodeproj/project.pbxproj
| ... | ... | @@ -497,7 +497,7 @@ |
| 497 | 497 | PRODUCT_BUNDLE_IDENTIFIER = com.deepwireless.crabcrab; |
| 498 | 498 | PRODUCT_NAME = GameSDKDemo; |
| 499 | 499 | PROVISIONING_PROFILE = ""; |
| 500 | - PROVISIONING_PROFILE_SPECIFIER = comdeepwirelesscrabcrabDis; | |
| 500 | + PROVISIONING_PROFILE_SPECIFIER = comdeepwirelesscrabcrabDev; | |
| 501 | 501 | PUBLIC_HEADERS_FOLDER_PATH = ""; |
| 502 | 502 | WRAPPER_EXTENSION = app; |
| 503 | 503 | }; |
ios/GameSDKDemo/GameSDKDemo.xcodeproj/project.xcworkspace/xcuserdata/yanglele.xcuserdatad/UserInterfaceState.xcuserstate
No preview for this file type
ios/GumpLoginSDK.framework/Versions/A/GumpLoginSDK
No preview for this file type
ios/GumpLoginSDK.framework/Versions/A/Headers/GPGameLoginSDK.h
| ... | ... | @@ -18,7 +18,7 @@ typedef enum:NSInteger{ |
| 18 | 18 | typedef void(^GPGameLoginSuccessBlock)(NSNumber *userId, ACCOUNTENTERTYPE type); |
| 19 | 19 | typedef void(^GPGameLoginFailureBlock)(void); |
| 20 | 20 | |
| 21 | -static NSString *version = @"1.0.11"; | |
| 21 | +static NSString *version = @"1.0.12"; | |
| 22 | 22 | @interface GPGameLoginSDK : NSObject |
| 23 | 23 | |
| 24 | 24 | @property(nonatomic, copy) GPGameLoginSuccessBlock succBlock; |