Commit f579320ff03e8be33cc03a3d8dc516b5732b866c

Authored by alexYang
1 parent 9fb44a9bfd
Exists in master

git tag修改

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.4.6 5 V 3.4.7
6 2017年4月25日 6 2017年5月12日
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 + 以下为可选,若接入bluePay第三方支付方式需要添加一下的framework和bundle,其中CoreBuePay.framework直接引入工程,之后再依次引入CoreTelephony.framework、MessageUI.framework、SystemConfiguration.framework,最后将BlueMobile.bundle拖入项目中 17 + 以下为可选,若接入bluePay第三方支付方式需要添加一下的framework和bundle,其中CoreBuePay.framework直接引入工程,之后再依次引入CoreTelephony.framework、MessageUI.framework、SystemConfiguration.framework,最后将BlueMobile.bundle拖入项目中
18 18
19 19
20 ### 2、引入头文件,设置build setting 20 ### 2、引入头文件,设置build setting
21 需要使用头文件有LetsGameAPI.h和VKBridge.h,其中VKBridge.h为接入vk时使用,不接入vk可忽略。 21 需要使用头文件有LetsGameAPI.h和VKBridge.h,其中VKBridge.h为接入vk时使用,不接入vk可忽略。
22 因sdk内使用了category,需要设置other linker flag为 -ObjC 22 因sdk内使用了category,需要设置other linker flag为 -ObjC
23 23
24 24
25 ### 3、增加必要配置 25 ### 3、增加必要配置
26 1)在application delegate中, 在application:openURL:sourceApplication:annotation:添加返回: 26 1)在application delegate中, 在application:openURL:sourceApplication:annotation:添加返回:
27 27
28 return [[LetsGameAPI instance] handleOpenURL:url sourceApplication:sourceApplication]; 28 return [[LetsGameAPI instance] handleOpenURL:url sourceApplication:sourceApplication];
29 29
30 30
31 2)配置URL-schema(vk专用,不接入vk可忽略) 31 2)配置URL-schema(vk专用,不接入vk可忽略)
32 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 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 ![](images/vk1.jpg) 33 ![](images/vk1.jpg)
34 Xcode 4: Open your Info.plist then add a new row URL Types. Set the URL identifier to vk+APP_ID 34 Xcode 4: Open your Info.plist then add a new row URL Types. Set the URL identifier to vk+APP_ID
35 ![](images/vk2.jpg) 35 ![](images/vk2.jpg)
36 36
37 3)配置plist和scheme(BluePay的linePay使用,不接入BluePay的LinePay可忽略) 37 3)配置plist和scheme(BluePay的linePay使用,不接入BluePay的LinePay可忽略)
38 38
39 plist部分: 39 plist部分:
40 <key>LSApplicationQueriesSchemes</key> 40 <key>LSApplicationQueriesSchemes</key>
41 <array> 41 <array>
42 <string>line</string> 42 <string>line</string>
43 </array> 43 </array>
44 scheme部分: 44 scheme部分:
45 <key>CFBundleURLTypes</key> 45 <key>CFBundleURLTypes</key>
46 <array> 46 <array>
47 <dict> 47 <dict>
48 <key>CFBundleTypeRole</key> 48 <key>CFBundleTypeRole</key>
49 <string>None</string> 49 <string>None</string>
50 <key>CFBundleURLName</key> 50 <key>CFBundleURLName</key>
51 <string>com.gump.sdk</string> 51 <string>com.gump.sdk</string>
52 <key>CFBundleURLSchemes</key> 52 <key>CFBundleURLSchemes</key>
53 <array> 53 <array>
54 <string> gump+游戏的appId </string> 54 <string> gump+游戏的appId </string>
55 </array> 55 </array>
56 </dict> 56 </dict>
57 </array> 57 </array>
58 ### 4、在工程里添加SDK登录代码 58 ### 4、在工程里添加SDK登录代码
59 59
60 [LetsGameAPI instance].appId = @"100"; // 设置appId 60 [LetsGameAPI instance].appId = @"100"; // 设置appId
61 [LetsGameAPI instance].appKey = @"100"; // 设置appKey 61 [LetsGameAPI instance].appKey = @"100"; // 设置appKey
62 62
63 //启用vk的代码,需要填入vk appId,若不接入vk,可以忽略 63 //启用vk的代码,需要填入vk appId,若不接入vk,可以忽略
64 //VKBridge *vkBridge = [[VKBridge alloc] initWithVKAppId:@"5029792"]; 64 //VKBridge *vkBridge = [[VKBridge alloc] initWithVKAppId:@"5029792"];
65 //[LetsGameAPI instance].vkBridge = vkBridge; 65 //[LetsGameAPI instance].vkBridge = vkBridge;
66 66
67 //隐藏fb登录 67 //隐藏fb登录
68 [LetsGameAPI disableFB:YES]; 68 [LetsGameAPI disableFB:YES];
69 //隐藏Google登录 69 //隐藏Google登录
70 [LetsGameAPI disableGoogle:YES]; 70 [LetsGameAPI disableGoogle:YES];
71 //隐藏gumptech的logo 71 //隐藏gumptech的logo
72 [LetsGameAPI hiddenLogo:YES]; 72 [LetsGameAPI hiddenLogo:YES];
73 73
74 [[LetsGameAPI instance] showLoginView]; // 弹出登录页面 74 [[LetsGameAPI instance] showLoginView]; // 弹出登录页面
75 75
76 // 登录成功回调 76 // 登录成功回调
77 [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) { 77 [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) {
78 NSLog(@"%@", [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %d", userId, sessionKey, type]); 78 NSLog(@"%@", [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %d", userId, sessionKey, type]);
79 }; 79 };
80 80
81 // 登录失败回调 81 // 登录失败回调
82 [LetsGameAPI instance].dismissBlock = ^() { 82 [LetsGameAPI instance].dismissBlock = ^() {
83 NSLog(@"dismiss without login"); 83 NSLog(@"dismiss without login");
84 }; 84 };
85 85
86 ### 5、登录注销 86 ### 5、登录注销
87 注销接口只要设置过appId和appKey之后就不需要设置了,注销完成之后会回到登录界面。FB登录回到登录页面,Gump登录或者游客登录回到登录框。 87 注销接口只要设置过appId和appKey之后就不需要设置了,注销完成之后会回到登录界面。FB登录回到登录页面,Gump登录或者游客登录回到登录框。
88 88
89 [LetsGameAPI instance].appId = @"100";//设置appId 89 [LetsGameAPI instance].appId = @"100";//设置appId
90 [LetsGameAPI instance].appKey = @"100";//设置appkey 90 [LetsGameAPI instance].appKey = @"100";//设置appkey
91 [[LetsGameAPI instance] logout]; //注销 91 [[LetsGameAPI instance] logout]; //注销
92 92
93 93
94 ### 6、第三方支付 94 ### 6、第三方支付
95 [LetsGameAPI instance].appId = @"10022"; 95 [LetsGameAPI instance].appId = @"10022";
96 [LetsGameAPI instance].appKey = @"f899139df5e1059396431415e770c6dd"; 96 [LetsGameAPI instance].appKey = @"f899139df5e1059396431415e770c6dd";
97 NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; 97 NSMutableDictionary *payInfo = [NSMutableDictionary dictionary];
98 [payInfo setValue:@"5001" forKey:@"serverId"];//服务器id,必传参数 98 [payInfo setValue:@"5001" forKey:@"serverId"];//服务器id,必传参数
99 [payInfo setValue:@"10010" forKey:@"roleId"];//用户角色id 99 [payInfo setValue:@"10010" forKey:@"roleId"];//用户角色id
100 [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id 100 [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id
101 [payInfo setValue:@"10" forKey:@"amount"];//金额 101 [payInfo setValue:@"10" forKey:@"amount"];//金额
102 [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//外部订单信息 102 [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//外部订单信息
103 [payInfo setValue:@"元宝" forKey:@"product"];//物品信息 103 [payInfo setValue:@"元宝" forKey:@"product"];//物品信息
104 [payInfo setValue:self.sessionKey forKey:@"sessionKey"];//登录成功的sessionKey 104 [payInfo setValue:self.sessionKey forKey:@"sessionKey"];//登录成功的sessionKey
105 [[LetsGameAPI instance] pay:payInfo handleCallBack:^{ 105 [[LetsGameAPI instance] pay:payInfo handleCallBack:^{
106 //第三方支付完成时的回调(包括支付成功和支付失败,除了支付过程中取消的),取消的不会有回调 106 //第三方支付完成时的回调(包括支付成功和支付失败,除了支付过程中取消的),取消的不会有回调
107 NSLog(@"第三方支付完成"); 107 NSLog(@"第三方支付完成");
108 }]]; 108 }]];
109 109
110 ### 7、IAP支付 110 ### 7、IAP支付
111 若要使用apple IAP支付,需要在AppDelegate的application: didFinishLaunchingWithOptions:方法内注册iap observer,使用如下方法 111 若要使用apple IAP支付,需要在AppDelegate的application: didFinishLaunchingWithOptions:方法内注册iap observer,使用如下方法
112 112
113 [[LetsGameAPI instance] registeIapObserver]; 113 [[LetsGameAPI instance] registeIapObserver];
114 具体调用iap支付的方法如下: 114 具体调用iap支付的方法如下:
115 115
116 [LetsGameAPI instance].appId = @"10022"; 116 [LetsGameAPI instance].appId = @"10022";
117 [LetsGameAPI instance].appKey = @"93a27b0bd99bac3e68a440b48aa421ab"; 117 [LetsGameAPI instance].appKey = @"93a27b0bd99bac3e68a440b48aa421ab";
118 NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; 118 NSMutableDictionary *payInfo = [NSMutableDictionary dictionary];
119 [payInfo setValue:@"5001" forKey:@"serverId"];//当前用户所在的服务器Id 119 [payInfo setValue:@"5001" forKey:@"serverId"];//当前用户所在的服务器Id
120 [payInfo setValue:@"10010" forKey:@"roleId"];//当前用户的角色id 120 [payInfo setValue:@"10010" forKey:@"roleId"];//当前用户的角色id
121 [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id,用于统计 121 [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id,用于统计
122 [payInfo setValue:@"10" forKey:@"amount"];//对应支付项的支付金额,实际支付金额以itunes配置为准 122 [payInfo setValue:@"10" forKey:@"amount"];//对应支付项的支付金额,实际支付金额以itunes配置为准
123 [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//扩展信息,可以游戏自定义,建议传自有订单号 123 [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//扩展信息,可以游戏自定义,建议传自有订单号
124 [payInfo setValue:@"test.product.1" forKey:@"product"];//itunes 后台配置的对应支付项的productId 124 [payInfo setValue:@"test.product.1" forKey:@"product"];//itunes 后台配置的对应支付项的productId
125 [[LetsGameAPI instance] iap:payInfo forUser:@"" handleCallback:^(NSString* orderId){ 125 [[LetsGameAPI instance] iap:payInfo forUser:@"" handleCallback:^(NSString* orderId){
126 //此处的回调表明支付已经完成,但此时支付不一定成功,需要服务端验证支付结果 126 //此处的回调表明支付已经完成,但此时支付不一定成功,需要服务端验证支付结果
127 //orderId为gump生成的订单号,此订单号可以在gump server查询此笔支付是否成功 127 //orderId为gump生成的订单号,此订单号可以在gump server查询此笔支付是否成功
128 NSLog(@"iap completed orderId of gumptech:%@",orderId); 128 NSLog(@"iap completed orderId of gumptech:%@",orderId);
129 }]; 129 }];
130 ### 8、token的获取 130 ### 8、token的获取
131 FB登录之后会产生token并自动登录,需要如果需要token的话,需要自己调用接口获取。 131 FB登录之后会产生token并自动登录,需要如果需要token的话,需要自己调用接口获取。
132 132
133 //tokenString:token字符串 133 //tokenString:token字符串
134 //refreshTime:refreshTime token最后刷新的时间,即获取的token的时间 134 //refreshTime:refreshTime token最后刷新的时间,即获取的token的时间
135 //expirationTime:expirationTime token最后的有效时间 135 //expirationTime:expirationTime token最后的有效时间
136 [[LetsGameAPI instance] obtainAccessTokenSuccess:^(NSString *tokenString, NSString *refreshTime, NSString *expirationTime) { 136 [[LetsGameAPI instance] obtainAccessTokenSuccess:^(NSString *tokenString, NSString *refreshTime, NSString *expirationTime) {
137 NSLog(@"tokenString %@, refreshTime %@, expirationTime %@", tokenString, refreshTime, expirationTime); 137 NSLog(@"tokenString %@, refreshTime %@, expirationTime %@", tokenString, refreshTime, expirationTime);
138 } failure:^(NSString *errorString) { 138 } failure:^(NSString *errorString) {
139 NSLog(@"get token faile"); 139 NSLog(@"get token faile");
140 }]; 140 }];
141 141
142 142
143 ### 9、第三方支付版本 143 ### 9、第三方支付版本
144 第三方支付,分成两个版本:没有gump币和有gump币,不设置时默认为带gump币版本,如果使用不带gump币的版本如下设置: 144 第三方支付,分成两个版本:没有gump币和有gump币,不设置时默认为带gump币版本,如果使用不带gump币的版本如下设置:
145 145
146 需要在 application:didFinishLaunchingWithOptions方法中添加: 146 需要在 application:didFinishLaunchingWithOptions方法中添加:
147 147
148 [[LetsGameAPI instance] decideWebPayVersion:1] 148 [[LetsGameAPI instance] decideWebPayVersion:1]
149 149
150 150
151 ### 10、关于侵权还是侵权的接口显示 151 ### 10、关于侵权还是侵权的接口显示
152 运营在后台配置此包名和版本在什么时候显示侵权内容还是不侵权内容,此接口调用需要在游戏才开始加载的时候调用,返回值是YES的时候显示侵权内容,在NO的时候显示不侵权内容。 152 运营在后台配置此包名和版本在什么时候显示侵权内容还是不侵权内容,此接口调用需要在游戏才开始加载的时候调用,返回值是YES的时候显示侵权内容,在NO的时候显示不侵权内容。
153 153
154 注意:关于运营配置的游戏的版本号,我们默认取的是Bulid版本号的值,请注意。 154 注意:关于运营配置的游戏的版本号,我们默认取的是Bulid版本号的值,请注意。
155 155
156 [[LetsGameAPI instance] gameObtainSafeSetInfoWithAppId:@"10056" ChannelId:@"1000" handleCallBack:^(BOOL resultStatus) { 156 [[LetsGameAPI instance] gameObtainSafeSetInfoWithAppId:@"10056" ChannelId:@"1000" handleCallBack:^(BOOL resultStatus) {
157 if (resultStatus) { 157 if (resultStatus) {
158 NSLog(@"YES 侵权"); 158 NSLog(@"YES 侵权");
159 }else{ 159 }else{
160 NSLog(@"NO 不侵权"); 160 NSLog(@"NO 不侵权");
161 } 161 }
162 }]; 162 }];
163 163
164 164
165 165
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 typedef void (^LSGDismissBlock)(void); 8 typedef void (^LSGDismissBlock)(void);
9 9
10 static BOOL isDisableFB = NO; 10 static BOOL isDisableFB = NO;
11 11
12 static BOOL isEnableVK = NO; 12 static BOOL isEnableVK = NO;
13 13
14 static BOOL isDisableGoogle = NO; 14 static BOOL isDisableGoogle = NO;
15 15
16 static BOOL hiddenLogo = NO; 16 static BOOL hiddenLogo = NO;
17 17
18 static NSString *version = @"3.4.6"; 18 static NSString *version = @"3.4.7";
19 19
20 @interface LetsGameAPI : NSObject<UIApplicationDelegate> 20 @interface LetsGameAPI : NSObject<UIApplicationDelegate>
21 21
22 @property (nonatomic, strong) NSString *appId; 22 @property (nonatomic, strong) NSString *appId;
23 @property (nonatomic, strong) NSString *appKey; 23 @property (nonatomic, strong) NSString *appKey;
24 @property (nonatomic, copy) LSGLoginSuccBlock succBlock; 24 @property (nonatomic, copy) LSGLoginSuccBlock succBlock;
25 @property (nonatomic, copy) LSGDismissBlock dismissBlock; 25 @property (nonatomic, copy) LSGDismissBlock dismissBlock;
26 @property (nonatomic, assign) int isDebug; 26 @property (nonatomic, assign) int isDebug;
27 @property (nonatomic, assign) int decideWebPay; 27 @property (nonatomic, assign) int decideWebPay;
28 @property (nonatomic,retain) id<VKBridgeProtocol> vkBridge; 28 @property (nonatomic,retain) id<VKBridgeProtocol> vkBridge;
29 //@property(nonatomic,strong) NSString *version; 29 //@property(nonatomic,strong) NSString *version;
30 30
31 + (instancetype)instance; 31 + (instancetype)instance;
32 32
33 -(NSString*)version; 33 -(NSString*)version;
34 34
35 - (void)showLoginView; 35 - (void)showLoginView;
36 - (void)showLoginViewInView:(UIView *)view; 36 - (void)showLoginViewInView:(UIView *)view;
37 37
38 +(void)disableFB:(BOOL)isDisable; 38 +(void)disableFB:(BOOL)isDisable;
39 +(void)disableGoogle:(BOOL)isDisable; 39 +(void)disableGoogle:(BOOL)isDisable;
40 +(BOOL)isFBDisable; 40 +(BOOL)isFBDisable;
41 +(BOOL)isVKEnable; 41 +(BOOL)isVKEnable;
42 +(BOOL)isGoogleDisable; 42 +(BOOL)isGoogleDisable;
43 +(void)hiddenLogo:(BOOL)isHidden; 43 +(void)hiddenLogo:(BOOL)isHidden;
44 +(BOOL)isHiddenLogo; 44 +(BOOL)isHiddenLogo;
45 45
46 - (void)logout; 46 - (void)logout;
47 47
48 - (void)hide; 48 - (void)hide;
49 49
50 - (BOOL)handleOpenURL:(NSURL *)url 50 - (BOOL)handleOpenURL:(NSURL *)url
51 sourceApplication:(NSString *)sourceApplication; 51 sourceApplication:(NSString *)sourceApplication;
52 52
53 -(void)pay:(NSDictionary*) payInfo handleCallBack:(void (^)()) payAccomplistCallback; 53 -(void)pay:(NSDictionary*) payInfo handleCallBack:(void (^)()) payAccomplistCallback;
54 54
55 -(void)iap:(NSDictionary*) payInfo forUser:(NSString*) uid handleCallback:(void (^)(NSString* orderId)) callback; 55 -(void)iap:(NSDictionary*) payInfo forUser:(NSString*) uid handleCallback:(void (^)(NSString* orderId)) callback;
56 56
57 -(void)registeIapObserver; 57 -(void)registeIapObserver;
58 58
59 -(void)decideIsDebug:(int)isDebug; 59 -(void)decideIsDebug:(int)isDebug;
60 60
61 -(void)decideWebPayVersion:(int)decideWebPay; 61 -(void)decideWebPayVersion:(int)decideWebPay;
62 62
63 -(void)obtainAccessTokenSuccess:(void (^)(NSString *tokenString, NSString *refreshTime, NSString *expirationTime))success 63 -(void)obtainAccessTokenSuccess:(void (^)(NSString *tokenString, NSString *refreshTime, NSString *expirationTime))success
64 failure:(void (^)(NSString *errorString))failure; 64 failure:(void (^)(NSString *errorString))failure;
65 65
66 //获取是否展示安全页面,YES展示侵权页面,NO展示非侵权页面 66 //获取是否展示安全页面,YES展示侵权页面,NO展示非侵权页面
67 -(void)gameObtainSafeSetInfoWithAppId:(NSString *)appId 67 -(void)gameObtainSafeSetInfoWithAppId:(NSString *)appId
68 ChannelId:(NSString *)channelId 68 ChannelId:(NSString *)channelId
69 handleCallBack:(void (^)(BOOL resultStatus))callBack; 69 handleCallBack:(void (^)(BOOL resultStatus))callBack;
70 @end 70 @end
71 71
No preview for this file type
ios/GameSDKDemo/GameSDKDemo.xcodeproj/project.xcworkspace/xcuserdata/yanglele.xcuserdatad/UserInterfaceState.xcuserstate
No preview for this file type