Commit 588429968cbf0d0c43870356b8442c82a3cbde7c
1 parent
ca2f3a9359
Exists in
master
add images for ios doc
Showing 3 changed files with 2 additions and 0 deletions Inline Diff
doc/IOSDocument.md
1 | # Gump IOS SDK使用文档 | 1 | # Gump IOS SDK使用文档 |
2 | 2 | ||
3 | 3 | ||
4 | 接入手册 | 4 | 接入手册 |
5 | V | 5 | V |
6 | 2015年09月25日 | 6 | 2015年09月25日 |
7 | 7 | ||
8 | 8 | ||
9 | 9 | ||
10 | ## 1、添加动态库 | 10 | ## 1、添加动态库 |
11 | 在工程里添加MobileCoreServices.framework、SystemConfiguration.framework、libz.dylib、CFNetwork.framework、libletsgame.a、StoreKit.framework、VKSdk.framework | 11 | 在工程里添加MobileCoreServices.framework、SystemConfiguration.framework、libz.dylib、CFNetwork.framework、libletsgame.a、StoreKit.framework、VKSdk.framework |
12 | 12 | ||
13 | 13 | ||
14 | ## 2、设置头文件搜索路径 | 14 | ## 2、设置头文件搜索路径 |
15 | 头文件只有LetsGameAPI.h和LSGAccount.h两个文件,引入头文件,并设置搜索路径。 | 15 | 头文件只有LetsGameAPI.h和LSGAccount.h两个文件,引入头文件,并设置搜索路径。 |
16 | 16 | ||
17 | 17 | ||
18 | ## 3、添加资源文件 | 18 | ## 3、添加资源文件 |
19 | 在工程里添加letsgame.bundle和VKSDKResources.bundle资源文件,里面包含图片及相关语言包 | 19 | 在工程里添加letsgame.bundle和VKSDKResources.bundle资源文件,里面包含图片及相关语言包 |
20 | 20 | ||
21 | ## 4、为vk增加必要配置 | 21 | ## 4、为vk增加必要配置 |
22 | 1)在application delegate方法中, 在application:openURL:sourceApplication:annotation:添加返回: | 22 | 1)在application delegate方法中, 在application:openURL:sourceApplication:annotation:添加返回: |
23 | 23 | ||
24 | return [[LetsGameAPI instance] handleOpenURL:url sourceApplication:sourceApplication]; | 24 | return [[LetsGameAPI instance] handleOpenURL:url sourceApplication:sourceApplication]; |
25 | 25 | ||
26 | 2)配置URL-schema | 26 | 2)配置URL-schema |
27 | 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. | 27 | 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. |
28 |  | ||
28 | Xcode 4: Open your Info.plist then add a new row URL Types. Set the URL identifier to vk+APP_ID | 29 | Xcode 4: Open your Info.plist then add a new row URL Types. Set the URL identifier to vk+APP_ID |
30 |  | ||
29 | ## 5、在工程里添加SDK登录代码 | 31 | ## 5、在工程里添加SDK登录代码 |
30 | 32 | ||
31 | [LetsGameAPI instance].appId = @"100"; // 设置appId | 33 | [LetsGameAPI instance].appId = @"100"; // 设置appId |
32 | [LetsGameAPI instance].appKey = @"100"; // 设置appKey | 34 | [LetsGameAPI instance].appKey = @"100"; // 设置appKey |
33 | [LetsGameAPI instance].vkAppId = @"5029792"; //设置vkAppId | 35 | [LetsGameAPI instance].vkAppId = @"5029792"; //设置vkAppId |
34 | 36 | ||
35 | [[LetsGameAPI instance] showLoginView]; // 弹出登录页面 | 37 | [[LetsGameAPI instance] showLoginView]; // 弹出登录页面 |
36 | 38 | ||
37 | // 登录成功回调 | 39 | // 登录成功回调 |
38 | [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) { | 40 | [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) { |
39 | NSLog(@"%@", [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %d", userId, sessionKey, type]); | 41 | NSLog(@"%@", [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %d", userId, sessionKey, type]); |
40 | }; | 42 | }; |
41 | 43 | ||
42 | // 登录失败回调 | 44 | // 登录失败回调 |
43 | [LetsGameAPI instance].dismissBlock = ^() { | 45 | [LetsGameAPI instance].dismissBlock = ^() { |
44 | NSLog(@"dismiss without login"); | 46 | NSLog(@"dismiss without login"); |
45 | }; | 47 | }; |
46 | 48 | ||
47 | 49 | ||
48 | ## 6、第三方支付 | 50 | ## 6、第三方支付 |
49 | [LetsGameAPI instance].appId = @"10022"; | 51 | [LetsGameAPI instance].appId = @"10022"; |
50 | [LetsGameAPI instance].appKey = @"f899139df5e1059396431415e770c6dd"; | 52 | [LetsGameAPI instance].appKey = @"f899139df5e1059396431415e770c6dd"; |
51 | NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; | 53 | NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; |
52 | [payInfo setValue:@"5001" forKey:@"serverId"];//服务器id,必传参数 | 54 | [payInfo setValue:@"5001" forKey:@"serverId"];//服务器id,必传参数 |
53 | [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id | 55 | [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id |
54 | [payInfo setValue:@"10" forKey:@"amount"];//金额 | 56 | [payInfo setValue:@"10" forKey:@"amount"];//金额 |
55 | [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//外部订单信息 | 57 | [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//外部订单信息 |
56 | [payInfo setValue:@"元宝" forKey:@"product"];//物品信息 | 58 | [payInfo setValue:@"元宝" forKey:@"product"];//物品信息 |
57 | [[LetsGameAPI instance] pay:payInfo]; | 59 | [[LetsGameAPI instance] pay:payInfo]; |
58 | 60 | ||
59 | ## 7、IAP支付 | 61 | ## 7、IAP支付 |
60 | 若要使用apple IAP支付,需要在AppDelegate的application: didFinishLaunchingWithOptions:方法内注册iap observer,使用如下方法 | 62 | 若要使用apple IAP支付,需要在AppDelegate的application: didFinishLaunchingWithOptions:方法内注册iap observer,使用如下方法 |
61 | 63 | ||
62 | [[LetsGameAPI instance] registeIapObserver]; | 64 | [[LetsGameAPI instance] registeIapObserver]; |
63 | 具体调用iap支付的方法如下: | 65 | 具体调用iap支付的方法如下: |
64 | 66 | ||
65 | [LetsGameAPI instance].appId = @"10022"; | 67 | [LetsGameAPI instance].appId = @"10022"; |
66 | [LetsGameAPI instance].appKey = @"93a27b0bd99bac3e68a440b48aa421ab"; | 68 | [LetsGameAPI instance].appKey = @"93a27b0bd99bac3e68a440b48aa421ab"; |
67 | NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; | 69 | NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; |
68 | [payInfo setValue:@"5001" forKey:@"serverId"];//当前用户所在的服务器Id | 70 | [payInfo setValue:@"5001" forKey:@"serverId"];//当前用户所在的服务器Id |
69 | [payInfo setValue:@"10010" forKey:@"roleId"];//当前用户的角色id | 71 | [payInfo setValue:@"10010" forKey:@"roleId"];//当前用户的角色id |
70 | [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id,用于统计 | 72 | [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id,用于统计 |
71 | [payInfo setValue:@"10" forKey:@"amount"];//对应支付项的支付金额,实际支付金额以itunes配置为准 | 73 | [payInfo setValue:@"10" forKey:@"amount"];//对应支付项的支付金额,实际支付金额以itunes配置为准 |
72 | [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//扩展信息,可以游戏自定义,建议传自有订单号 | 74 | [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//扩展信息,可以游戏自定义,建议传自有订单号 |
73 | [payInfo setValue:@"test.product.1" forKey:@"product"];//itunes 后台配置的对应支付项的productId | 75 | [payInfo setValue:@"test.product.1" forKey:@"product"];//itunes 后台配置的对应支付项的productId |
74 | [[LetsGameAPI instance] iap:payInfo forUser:@"" handleCallback:^(NSString* orderId){ | 76 | [[LetsGameAPI instance] iap:payInfo forUser:@"" handleCallback:^(NSString* orderId){ |
75 | //此处的回调表明支付已经完成,但此时支付不一定成功,需要服务端验证支付结果 | 77 | //此处的回调表明支付已经完成,但此时支付不一定成功,需要服务端验证支付结果 |
76 | //orderId为gump生成的订单号,此订单号可以在gump server查询此笔支付是否成功 | 78 | //orderId为gump生成的订单号,此订单号可以在gump server查询此笔支付是否成功 |
77 | NSLog(@"iap completed orderId of gumptech:%@",orderId); | 79 | NSLog(@"iap completed orderId of gumptech:%@",orderId); |
78 | }]; | 80 | }]; |
doc/images/vk1.jpg
11.6 KB
doc/images/vk2.jpg
6.35 KB