Commit 4d882ee7bd593e870866836dca353f295c7de61a

Authored by alexYang
1 parent 2ef9eacc08
Exists in master

web支付地址修改

Showing 5 changed files with 3 additions and 3 deletions Inline Diff

1 # Gump IOS SDK使用文档 1 # Gump IOS SDK使用文档
2 2
3 3
4 接入手册 4 接入手册
5 V 3.3.9 5 V 3.3.10
6 2016年08月16日 6 2016年08月25日
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、libsqlite3.tbd 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版本 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 17
18 18
19 ### 2、引入头文件,设置build setting 19 ### 2、引入头文件,设置build setting
20 需要使用头文件有LetsGameAPI.h和VKBridge.h,其中VKBridge.h为接入vk时使用,不接入vk可忽略。 20 需要使用头文件有LetsGameAPI.h和VKBridge.h,其中VKBridge.h为接入vk时使用,不接入vk可忽略。
21 因sdk内使用了category,需要设置other linker flag为 -ObjC 21 因sdk内使用了category,需要设置other linker flag为 -ObjC
22 22
23 23
24 ### 3、增加必要配置 24 ### 3、增加必要配置
25 1)在application delegate中, 在application:openURL:sourceApplication:annotation:添加返回: 25 1)在application delegate中, 在application:openURL:sourceApplication:annotation:添加返回:
26 26
27 return [[LetsGameAPI instance] handleOpenURL:url sourceApplication:sourceApplication]; 27 return [[LetsGameAPI instance] handleOpenURL:url sourceApplication:sourceApplication];
28 28
29 29
30 2)配置URL-schema(vk专用,不接入vk可忽略) 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. 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) 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 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) 34 ![](images/vk2.jpg)
35 ### 4、在工程里添加SDK登录代码 35 ### 4、在工程里添加SDK登录代码
36 36
37 [LetsGameAPI instance].appId = @"100"; // 设置appId 37 [LetsGameAPI instance].appId = @"100"; // 设置appId
38 [LetsGameAPI instance].appKey = @"100"; // 设置appKey 38 [LetsGameAPI instance].appKey = @"100"; // 设置appKey
39 39
40 //启用vk的代码,需要填入vk appId,若不接入vk,可以忽略 40 //启用vk的代码,需要填入vk appId,若不接入vk,可以忽略
41 //VKBridge *vkBridge = [[VKBridge alloc] initWithVKAppId:@"5029792"]; 41 //VKBridge *vkBridge = [[VKBridge alloc] initWithVKAppId:@"5029792"];
42 //[LetsGameAPI instance].vkBridge = vkBridge; 42 //[LetsGameAPI instance].vkBridge = vkBridge;
43 43
44 //隐藏fb登录 44 //隐藏fb登录
45 [LetsGameAPI disableFB:YES]; 45 [LetsGameAPI disableFB:YES];
46 46
47 //隐藏gumptech的logo 47 //隐藏gumptech的logo
48 [LetsGameAPI hiddenLogo:YES]; 48 [LetsGameAPI hiddenLogo:YES];
49 49
50 [[LetsGameAPI instance] showLoginView]; // 弹出登录页面 50 [[LetsGameAPI instance] showLoginView]; // 弹出登录页面
51 51
52 // 登录成功回调 52 // 登录成功回调
53 [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) { 53 [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) {
54 NSLog(@"%@", [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %d", userId, sessionKey, type]); 54 NSLog(@"%@", [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %d", userId, sessionKey, type]);
55 }; 55 };
56 56
57 // 登录失败回调 57 // 登录失败回调
58 [LetsGameAPI instance].dismissBlock = ^() { 58 [LetsGameAPI instance].dismissBlock = ^() {
59 NSLog(@"dismiss without login"); 59 NSLog(@"dismiss without login");
60 }; 60 };
61 61
62 62
63 ### 5、第三方支付 63 ### 5、第三方支付
64 [LetsGameAPI instance].appId = @"10022"; 64 [LetsGameAPI instance].appId = @"10022";
65 [LetsGameAPI instance].appKey = @"f899139df5e1059396431415e770c6dd"; 65 [LetsGameAPI instance].appKey = @"f899139df5e1059396431415e770c6dd";
66 NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; 66 NSMutableDictionary *payInfo = [NSMutableDictionary dictionary];
67 [payInfo setValue:@"5001" forKey:@"serverId"];//服务器id,必传参数 67 [payInfo setValue:@"5001" forKey:@"serverId"];//服务器id,必传参数
68 [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id 68 [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id
69 [payInfo setValue:@"10" forKey:@"amount"];//金额 69 [payInfo setValue:@"10" forKey:@"amount"];//金额
70 [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//外部订单信息 70 [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//外部订单信息
71 [payInfo setValue:@"元宝" forKey:@"product"];//物品信息 71 [payInfo setValue:@"元宝" forKey:@"product"];//物品信息
72 [[LetsGameAPI instance] pay:payInfo]; 72 [[LetsGameAPI instance] pay:payInfo];
73 73
74 ### 6、IAP支付 74 ### 6、IAP支付
75 若要使用apple IAP支付,需要在AppDelegate的application: didFinishLaunchingWithOptions:方法内注册iap observer,使用如下方法 75 若要使用apple IAP支付,需要在AppDelegate的application: didFinishLaunchingWithOptions:方法内注册iap observer,使用如下方法
76 76
77 [[LetsGameAPI instance] registeIapObserver]; 77 [[LetsGameAPI instance] registeIapObserver];
78 具体调用iap支付的方法如下: 78 具体调用iap支付的方法如下:
79 79
80 [LetsGameAPI instance].appId = @"10022"; 80 [LetsGameAPI instance].appId = @"10022";
81 [LetsGameAPI instance].appKey = @"93a27b0bd99bac3e68a440b48aa421ab"; 81 [LetsGameAPI instance].appKey = @"93a27b0bd99bac3e68a440b48aa421ab";
82 NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; 82 NSMutableDictionary *payInfo = [NSMutableDictionary dictionary];
83 [payInfo setValue:@"5001" forKey:@"serverId"];//当前用户所在的服务器Id 83 [payInfo setValue:@"5001" forKey:@"serverId"];//当前用户所在的服务器Id
84 [payInfo setValue:@"10010" forKey:@"roleId"];//当前用户的角色id 84 [payInfo setValue:@"10010" forKey:@"roleId"];//当前用户的角色id
85 [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id,用于统计 85 [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id,用于统计
86 [payInfo setValue:@"10" forKey:@"amount"];//对应支付项的支付金额,实际支付金额以itunes配置为准 86 [payInfo setValue:@"10" forKey:@"amount"];//对应支付项的支付金额,实际支付金额以itunes配置为准
87 [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//扩展信息,可以游戏自定义,建议传自有订单号 87 [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//扩展信息,可以游戏自定义,建议传自有订单号
88 [payInfo setValue:@"test.product.1" forKey:@"product"];//itunes 后台配置的对应支付项的productId 88 [payInfo setValue:@"test.product.1" forKey:@"product"];//itunes 后台配置的对应支付项的productId
89 [[LetsGameAPI instance] iap:payInfo forUser:@"" handleCallback:^(NSString* orderId){ 89 [[LetsGameAPI instance] iap:payInfo forUser:@"" handleCallback:^(NSString* orderId){
90 //此处的回调表明支付已经完成,但此时支付不一定成功,需要服务端验证支付结果 90 //此处的回调表明支付已经完成,但此时支付不一定成功,需要服务端验证支付结果
91 //orderId为gump生成的订单号,此订单号可以在gump server查询此笔支付是否成功 91 //orderId为gump生成的订单号,此订单号可以在gump server查询此笔支付是否成功
92 NSLog(@"iap completed orderId of gumptech:%@",orderId); 92 NSLog(@"iap completed orderId of gumptech:%@",orderId);
93 }]; 93 }];
94 ### 7、SDK版本测试设置 94 ### 7、SDK版本测试设置
95 若想使用SDK的debug版本,需要在AppDelegate的application: didFinishLaunchingWithOptions:中设置: 95 若想使用SDK的debug版本,需要在AppDelegate的application: didFinishLaunchingWithOptions:中设置:
96 [[LetsGameAPI instance] decideIsDebug:1]; 96 [[LetsGameAPI instance] decideIsDebug:1];
97 不设置或者设置为0时,默认使用release版本 97 不设置或者设置为0时,默认使用release版本
98 98
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 8
9 typedef void (^LSGDismissBlock)(void); 9 typedef void (^LSGDismissBlock)(void);
10 10
11 static BOOL isDisableFB = NO; 11 static BOOL isDisableFB = NO;
12 12
13 static BOOL isEnableVK = NO; 13 static BOOL isEnableVK = NO;
14 14
15 static BOOL hiddenLogo = NO; 15 static BOOL hiddenLogo = NO;
16 16
17 static NSString *version = @"3.3.9"; 17 static NSString *version = @"3.3.10";
18 18
19 @interface LetsGameAPI : NSObject<UIApplicationDelegate> 19 @interface LetsGameAPI : NSObject<UIApplicationDelegate>
20 20
21 @property (nonatomic, strong) NSString *appId; 21 @property (nonatomic, strong) NSString *appId;
22 @property (nonatomic, strong) NSString *appKey; 22 @property (nonatomic, strong) NSString *appKey;
23 @property (nonatomic, copy) LSGLoginSuccBlock succBlock; 23 @property (nonatomic, copy) LSGLoginSuccBlock succBlock;
24 @property (nonatomic, copy) LSGDismissBlock dismissBlock; 24 @property (nonatomic, copy) LSGDismissBlock dismissBlock;
25 @property (nonatomic, assign) int isDebug; 25 @property (nonatomic, assign) int isDebug;
26 26
27 @property (nonatomic,retain) id<VKBridgeProtocol> vkBridge; 27 @property (nonatomic,retain) id<VKBridgeProtocol> vkBridge;
28 //@property(nonatomic,strong) NSString *version; 28 //@property(nonatomic,strong) NSString *version;
29 29
30 + (instancetype)instance; 30 + (instancetype)instance;
31 31
32 -(NSString*)version; 32 -(NSString*)version;
33 33
34 - (void)showLoginView; 34 - (void)showLoginView;
35 - (void)showLoginViewInView:(UIView *)view; 35 - (void)showLoginViewInView:(UIView *)view;
36 36
37 +(void)disableFB:(BOOL)isDisable; 37 +(void)disableFB:(BOOL)isDisable;
38 +(BOOL)isFBDisable; 38 +(BOOL)isFBDisable;
39 +(BOOL)isVKEnable; 39 +(BOOL)isVKEnable;
40 +(void)hiddenLogo:(BOOL)isHidden; 40 +(void)hiddenLogo:(BOOL)isHidden;
41 +(BOOL)isHiddenLogo; 41 +(BOOL)isHiddenLogo;
42 42
43 - (void)logout; 43 - (void)logout;
44 44
45 - (void)hide; 45 - (void)hide;
46 46
47 - (BOOL)handleOpenURL:(NSURL *)url 47 - (BOOL)handleOpenURL:(NSURL *)url
48 sourceApplication:(NSString *)sourceApplication; 48 sourceApplication:(NSString *)sourceApplication;
49 49
50 -(void)pay:(NSDictionary*) payInfo; 50 -(void)pay:(NSDictionary*) payInfo;
51 51
52 -(void)iap:(NSDictionary*) payInfo forUser:(NSString*) uid handleCallback:(void (^)(NSString* orderId)) callback; 52 -(void)iap:(NSDictionary*) payInfo forUser:(NSString*) uid handleCallback:(void (^)(NSString* orderId)) callback;
53 53
54 -(void)registeIapObserver; 54 -(void)registeIapObserver;
55 55
56 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions; 56 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;
57 57
58 -(void)applicationWillTerminate:(UIApplication *)application; 58 -(void)applicationWillTerminate:(UIApplication *)application;
59 59
60 -(void)decideIsDebug:(int)isDebug; 60 -(void)decideIsDebug:(int)isDebug;
61 61
62 @end 62 @end
63 63
No preview for this file type
ios/GameSDKDemo/GameSDKDemo.xcodeproj/project.xcworkspace/xcuserdata/yanglele.xcuserdatad/UserInterfaceState.xcuserstate
No preview for this file type