Commit 699ab5519cecd726ec01005280f28dcd40a4473f

Authored by alexYang
1 parent 23a302b86e
Exists in master

SDK文档结构修改

Showing 19 changed files with 97 additions and 183 deletions Inline Diff

File was created 1 # Gump IOS SDK使用文档
2
3
4 接入手册
5 V 3.3.8
6 2016年07月04日
7
8 ## 概述
9 #### 本SDK提供gump账号,fb账号,vk账号三种账号登录,iap支付和第三方支付两种支付功能,其中gump账号登录和fb账号登录功能为必须接入,支付可根据需要选择性接入。
10
11 ## 接入步骤
12 ### 1、添加Framework和资源文件
13 + 以下为必须添加的framework以及资源bundle:
14 MobileCoreServices.framework、SystemConfiguration.framework、libz.dylib、CFNetwork.framework、GameSDK.framework、StoreKit.framework、GameSDKResources.bundle、libsqlite3.tbd
15 + 以下为可选,若接入vk登录则需要添加以下framework和bundle,其中VKSdk.framework和VKSDKResources.bundle请自行从vk.com下载,使用1.3版本
16 VKSdk.framework、VKBridge.framework、VKSDKResources.bundle
17
18
19 ### 2、引入头文件,设置build setting
20 需要使用头文件有LetsGameAPI.h和VKBridge.h,其中VKBridge.h为接入vk时使用,不接入vk可忽略。
21 因sdk内使用了category,需要设置other linker flag为 -ObjC
22
23
24 ### 3、增加必要配置
25 1)在application delegate中, 在application:openURL:sourceApplication:annotation:添加返回:
26
27 return [[LetsGameAPI instance] handleOpenURL:url sourceApplication:sourceApplication];
28
29
30 2)配置URL-schema(vk专用,不接入vk可忽略)
31 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 ![](images/vk1.jpg)
33 Xcode 4: Open your Info.plist then add a new row URL Types. Set the URL identifier to vk+APP_ID
34 ![](images/vk2.jpg)
35 ### 4、在工程里添加SDK登录代码
36
37 [LetsGameAPI instance].appId = @"100"; // 设置appId
38 [LetsGameAPI instance].appKey = @"100"; // 设置appKey
39
40 //启用vk的代码,需要填入vk appId,若不接入vk,可以忽略
41 //VKBridge *vkBridge = [[VKBridge alloc] initWithVKAppId:@"5029792"];
42 //[LetsGameAPI instance].vkBridge = vkBridge;
43
44 //隐藏fb登录
45 [LetsGameAPI disableFB:YES];
46
47 //隐藏gumptech的logo
48 [LetsGameAPI hiddenLogo:YES];
49
50 [[LetsGameAPI instance] showLoginView]; // 弹出登录页面
51
52 // 登录成功回调
53 [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) {
54 NSLog(@"%@", [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %d", userId, sessionKey, type]);
55 };
56
57 // 登录失败回调
58 [LetsGameAPI instance].dismissBlock = ^() {
59 NSLog(@"dismiss without login");
60 };
61
62
63 ### 5、第三方支付
64 [LetsGameAPI instance].appId = @"10022";
65 [LetsGameAPI instance].appKey = @"f899139df5e1059396431415e770c6dd";
66 NSMutableDictionary *payInfo = [NSMutableDictionary dictionary];
67 [payInfo setValue:@"5001" forKey:@"serverId"];//服务器id,必传参数
68 [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id
69 [payInfo setValue:@"10" forKey:@"amount"];//金额
70 [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//外部订单信息
71 [payInfo setValue:@"元宝" forKey:@"product"];//物品信息
72 [[LetsGameAPI instance] pay:payInfo];
73
74 ### 6、IAP支付
75 若要使用apple IAP支付,需要在AppDelegate的application: didFinishLaunchingWithOptions:方法内注册iap observer,使用如下方法
76
77 [[LetsGameAPI instance] registeIapObserver];
78 具体调用iap支付的方法如下:
79
80 [LetsGameAPI instance].appId = @"10022";
81 [LetsGameAPI instance].appKey = @"93a27b0bd99bac3e68a440b48aa421ab";
82 NSMutableDictionary *payInfo = [NSMutableDictionary dictionary];
83 [payInfo setValue:@"5001" forKey:@"serverId"];//当前用户所在的服务器Id
84 [payInfo setValue:@"10010" forKey:@"roleId"];//当前用户的角色id
85 [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id,用于统计
86 [payInfo setValue:@"10" forKey:@"amount"];//对应支付项的支付金额,实际支付金额以itunes配置为准
87 [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//扩展信息,可以游戏自定义,建议传自有订单号
88 [payInfo setValue:@"test.product.1" forKey:@"product"];//itunes 后台配置的对应支付项的productId
89 [[LetsGameAPI instance] iap:payInfo forUser:@"" handleCallback:^(NSString* orderId){
90 //此处的回调表明支付已经完成,但此时支付不一定成功,需要服务端验证支付结果
91 //orderId为gump生成的订单号,此订单号可以在gump server查询此笔支付是否成功
92 NSLog(@"iap completed orderId of gumptech:%@",orderId);
93 }];
94 ### 7、SDK版本测试设置
95 若想使用SDK的debug版本,需要在AppDelegate的application: didFinishLaunchingWithOptions:中设置:
96 [[LetsGameAPI instance] decideIsDebug:1];
97 不设置或者设置为0时,默认使用release版本
98
doc/GumpTechDocument.md
1 ## GumpTech SDK 接入文档 File was deleted
2
3 接入文档:
4 ----------------------------------
5 1. Android 部分 [here](http://git.letsgame.mobi/document/gumptech-document/blob/master/doc/AndroidDocument.md)
6 2. IOS部分
7 3. 服务端部分 [here](http://git.letsgame.mobi/document/gumptech-document/blob/master/doc/ServerDocument.md)
8 4. 页面支付部分 [here](http://git.letsgame.mobi/document/gumptech-document/blob/master/doc/webpay.md)
doc/IOSDocument.md
1 # Gump IOS SDK使用文档 File was deleted
2
3
4 接入手册
5 V 3.3.8
6 2016年07月04日
7
8 ## 概述
9 #### 本SDK提供gump账号,fb账号,vk账号三种账号登录,iap支付和第三方支付两种支付功能,其中gump账号登录和fb账号登录功能为必须接入,支付可根据需要选择性接入。
10
11 ## 接入步骤
12 ### 1、添加Framework和资源文件
13 + 以下为必须添加的framework以及资源bundle:
14 MobileCoreServices.framework、SystemConfiguration.framework、libz.dylib、CFNetwork.framework、GameSDK.framework、StoreKit.framework、GameSDKResources.bundle、libsqlite3.tbd
15 + 以下为可选,若接入vk登录则需要添加以下framework和bundle,其中VKSdk.framework和VKSDKResources.bundle请自行从vk.com下载,使用1.3版本
16 VKSdk.framework、VKBridge.framework、VKSDKResources.bundle
17
18
19 ### 2、引入头文件,设置build setting
20 需要使用头文件有LetsGameAPI.h和VKBridge.h,其中VKBridge.h为接入vk时使用,不接入vk可忽略。
21 因sdk内使用了category,需要设置other linker flag为 -ObjC
22
23
24 ### 3、增加必要配置
25 1)在application delegate中, 在application:openURL:sourceApplication:annotation:添加返回:
26
27 return [[LetsGameAPI instance] handleOpenURL:url sourceApplication:sourceApplication];
28
29
30 2)配置URL-schema(vk专用,不接入vk可忽略)
31 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 ![](images/vk1.jpg)
33 Xcode 4: Open your Info.plist then add a new row URL Types. Set the URL identifier to vk+APP_ID
34 ![](images/vk2.jpg)
35 ### 4、在工程里添加SDK登录代码
36
37 [LetsGameAPI instance].appId = @"100"; // 设置appId
38 [LetsGameAPI instance].appKey = @"100"; // 设置appKey
39
40 //启用vk的代码,需要填入vk appId,若不接入vk,可以忽略
41 //VKBridge *vkBridge = [[VKBridge alloc] initWithVKAppId:@"5029792"];
42 //[LetsGameAPI instance].vkBridge = vkBridge;
43
44 //隐藏fb登录
45 [LetsGameAPI disableFB:YES];
46
47 //隐藏gumptech的logo
48 [LetsGameAPI hiddenLogo:YES];
49
50 [[LetsGameAPI instance] showLoginView]; // 弹出登录页面
51
52 // 登录成功回调
53 [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) {
54 NSLog(@"%@", [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %d", userId, sessionKey, type]);
55 };
56
57 // 登录失败回调
58 [LetsGameAPI instance].dismissBlock = ^() {
59 NSLog(@"dismiss without login");
60 };
61
62
63 ### 5、第三方支付
64 [LetsGameAPI instance].appId = @"10022";
65 [LetsGameAPI instance].appKey = @"f899139df5e1059396431415e770c6dd";
66 NSMutableDictionary *payInfo = [NSMutableDictionary dictionary];
67 [payInfo setValue:@"5001" forKey:@"serverId"];//服务器id,必传参数
68 [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id
69 [payInfo setValue:@"10" forKey:@"amount"];//金额
70 [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//外部订单信息
71 [payInfo setValue:@"元宝" forKey:@"product"];//物品信息
72 [[LetsGameAPI instance] pay:payInfo];
73
74 ### 6、IAP支付
75 若要使用apple IAP支付,需要在AppDelegate的application: didFinishLaunchingWithOptions:方法内注册iap observer,使用如下方法
76
77 [[LetsGameAPI instance] registeIapObserver];
78 具体调用iap支付的方法如下:
79
80 [LetsGameAPI instance].appId = @"10022";
81 [LetsGameAPI instance].appKey = @"93a27b0bd99bac3e68a440b48aa421ab";
82 NSMutableDictionary *payInfo = [NSMutableDictionary dictionary];
83 [payInfo setValue:@"5001" forKey:@"serverId"];//当前用户所在的服务器Id
84 [payInfo setValue:@"10010" forKey:@"roleId"];//当前用户的角色id
85 [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id,用于统计
86 [payInfo setValue:@"10" forKey:@"amount"];//对应支付项的支付金额,实际支付金额以itunes配置为准
87 [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//扩展信息,可以游戏自定义,建议传自有订单号
88 [payInfo setValue:@"test.product.1" forKey:@"product"];//itunes 后台配置的对应支付项的productId
89 [[LetsGameAPI instance] iap:payInfo forUser:@"" handleCallback:^(NSString* orderId){
90 //此处的回调表明支付已经完成,但此时支付不一定成功,需要服务端验证支付结果
91 //orderId为gump生成的订单号,此订单号可以在gump server查询此笔支付是否成功
92 NSLog(@"iap completed orderId of gumptech:%@",orderId);
93 }];
94 ### 7、SDK版本测试设置
95 若想使用SDK的debug版本,需要在AppDelegate的application: didFinishLaunchingWithOptions:中设置:
96 [[LetsGameAPI instance] decideIsDebug:1];
97 不设置或者设置为0时,默认使用release版本
98 1 # Gump IOS SDK使用文档
doc/images/1.png

26.2 KB

doc/images/10.png

6.81 KB

doc/images/11.png

66 KB

doc/images/12.png

57.6 KB

doc/images/2.png

6.79 KB

doc/images/3.png

7.2 KB

doc/images/4.png

10.4 KB

doc/images/5.png

88.5 KB

doc/images/6.png

67.3 KB

doc/images/7.png

65.9 KB

doc/images/8.png

91.1 KB

doc/images/9.png

52.4 KB

doc/images/vk1.jpg

11.6 KB

doc/images/vk2.jpg

6.35 KB

doc/webgame.md
doc/webpay.md
1 以下两个接口需要研发商提供,否则支付的时候会出现"获取支付信息失败"提示 File was deleted
2 ----------------------------------
3 接口请联系运营人员配置到Gump管理后台
4
5
6 第三方查询角色接口(需要研发商提供)
7 -------------------------
8
9 GumpTech调用过程如下:
10 请求接口:queryRoleUrl的地址
11 请求方式:post
12 参数:
13 serverId servers参数json中的serverId的值
14 userId GumpTech用户id
15 返回值:
16 {
17 "userId":5104
18 "roleId":5104
19 "roleName":"卡卡"
20 }
21 userId为GumpTech平台的用户id
22 roleId为第三方平台的角色id
23 roleName为第三方平台的角色名字
24
25
26 第三方查询区服列表接口(需要研发商提供)
27 -------------------------
28
29
30 Gump调用过程如下:querySeversUrl的地址
31
32 请求方式:get方式
33 参数:无
34 返回值:
35
36 字符串格式json串,如下:
37 [
38 {"serverId":"s2", "serverName":"测试1"},
39 {"serverId":"s2", "serverName":"测试1"}
40 ...
41 ]
42
43
44 充值成功通知第三方服务端接口
45 -----------------------------
46
47
48 请参考[GumpTech服务端文档](http://git.letsgame.mobi/document/gumptech-document/blob/master/doc/ServerDocument.md)
49
50
51
52
53
54 GumpTech页面支付(已集成到sdk中,可忽略)
55 -----------------------
56
57 接入使用方式:
58 -----------------------
59 请使用浏览器方式嵌套GumpTech支付地址:
60
61 统一支付: http://api.gumptech.com/v2/p/index.do
62 横版: http://api.gumptech.com/v2/wide/p/index.do
63
64 横版V3: http://api.gumptech.com/v3/wide/p/index.do(引入Gump币支付)
65
66 需要传入参数:
67 1. appId: 必选参数 接入前GumpTeck分配的应用id
68 2. userId: 必选参数 GumpTech平台的用户id
69 3. serverId: 必选参数 注意次参数为字符串,必须保证跟获取区服列表中serverId值保证一致
70 4. extraInfo: 必选参数 第三方自定义字段,字符200以内,原样回调给第三方。
71 5. product: 必选参数 第三方传入,购买物品
72 6. amount: 可选参数 第三方传入,购买物品所需要的金额(点数)
73
74 7.sessionKey: V3版本必选 登录获取的sessionKey,支付使用
75
76 以下参数需要在服务端配置,需要研发商联系接口人配置:
77 1. queryRoleUrl: 支付页面显示服务器列表 参考【第三方查询角色接口】
78 2. querySeversUrl: 查询用户角色 格式参考【第三方查询区服列表接口】