Commit 44e1460f103fc44c995212f41e5bbf078c3695d8

Authored by alexYang
1 parent e8af757417
Exists in master and in 1 other branch dev

line login add,登录按钮布局排列优化

Showing 10 changed files with 110 additions and 87 deletions Inline Diff

1 # Gump IOS SDK使用文档 1 # Gump IOS SDK使用文档
2 2
3 3
4 接入手册 4 接入手册
5 V 3.4.9 5 V 3.4.11
6 2017年6月13日 6 2017年12月29日
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 + 以下可选,若接入微信登陆则需要添加如下的framework: 17 + 以下可选,若接入微信登陆则需要添加如下的framework:
18 libsqlite3.0.dylib, libc++.dylib, Security.framework, CoreTelephony.framework, CFNetwork.framework 18 libsqlite3.0.dylib, libc++.dylib, Security.framework, CoreTelephony.framework, CFNetwork.framework
19 19
20 20
21 ### 2、引入头文件,设置build setting 21 ### 2、引入头文件,设置build setting
22 需要使用头文件有LetsGameAPI.h和VKBridge.h,其中VKBridge.h为接入vk时使用,不接入vk可忽略。 22 需要使用头文件有LetsGameAPI.h和VKBridge.h,其中VKBridge.h为接入vk时使用,不接入vk可忽略。
23 因sdk内使用了category,需要设置other linker flag为 -ObjC 23 因sdk内使用了category,需要设置other linker flag为 -ObjC
24 24
25 25
26 ### 3、增加必要配置 26 ### 3、增加必要配置
27 1)在application delegate中, 在application:openURL:sourceApplication:annotation:添加返回: 27 1)在application delegate中, 在application:openURL:sourceApplication:annotation:添加返回:
28 28
29 return [[LetsGameAPI instance] handleOpenURL:url sourceApplication:sourceApplication]; 29 return [[LetsGameAPI instance] handleOpenURL:url sourceApplication:sourceApplication];
30 30
31 31
32 2)配置URL-schema(vk专用,不接入vk可忽略) 32 2)配置URL-schema(vk专用,不接入vk可忽略)
33 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 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.
34 ![](images/vk1.jpg) 34 ![](images/vk1.jpg)
35 Xcode 4: Open your Info.plist then add a new row URL Types. Set the URL identifier to vk+APP_ID 35 Xcode 4: Open your Info.plist then add a new row URL Types. Set the URL identifier to vk+APP_ID
36 ![](images/vk2.jpg) 36 ![](images/vk2.jpg)
37 3)配置UIL-schema(weChat专用,不接入可以忽略) 37 3)配置UIL-schema(weChat专用,不接入可以忽略)
38 选中“TARGETS”一栏,在“info”标签栏的“URL type“添加“URL scheme”为你所注册的应用程序id 38 选中“TARGETS”一栏,在“info”标签栏的“URL type“添加“URL scheme”为你所注册的应用程序id
39 选中“TARGETS”一栏,在“info”标签栏的“LSApplicationQueriesSchemes“添加weixin和wechat 39 选中“TARGETS”一栏,在“info”标签栏的“LSApplicationQueriesSchemes“添加weixin和wechat
40 40
41 ### 4、在工程里添加SDK登录代码 41 ### 4、在工程里添加SDK登录代码
42 42
43 [LetsGameAPI instance].appId = @"100"; // 设置appId 43 [LetsGameAPI instance].appId = @"100"; // 设置appId
44 [LetsGameAPI instance].appKey = @"100"; // 设置appKey 44 [LetsGameAPI instance].appKey = @"100"; // 设置appKey
45 45
46 //启用vk的代码,需要填入vk appId,若不接入vk,可以忽略 46 //启用vk的代码,需要填入vk appId,若不接入vk,可以忽略
47 //VKBridge *vkBridge = [[VKBridge alloc] initWithVKAppId:@"5029792"]; 47 //VKBridge *vkBridge = [[VKBridge alloc] initWithVKAppId:@"5029792"];
48 //[LetsGameAPI instance].vkBridge = vkBridge; 48 //[LetsGameAPI instance].vkBridge = vkBridge;
49 49
50 //隐藏fb登录 50 //隐藏fb登录
51 [LetsGameAPI disableFB:YES]; 51 [LetsGameAPI disableFB:YES];
52 //隐藏Google登录 52 //隐藏Google登录
53 [LetsGameAPI disableGoogle:YES]; 53 [LetsGameAPI disableGoogle:YES];
54 //隐藏gumptech的logo 54 //隐藏gumptech的logo
55 [LetsGameAPI hiddenLogo:YES]; 55 [LetsGameAPI hiddenLogo:YES];
56 56
57 [[LetsGameAPI instance] showLoginView]; // 弹出登录页面 57 [[LetsGameAPI instance] showLoginView]; // 弹出登录页面
58 58
59 // 登录成功回调 59 // 登录成功回调
60 [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) { 60 [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) {
61 NSLog(@"%@", [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %d", userId, sessionKey, type]); 61 NSLog(@"%@", [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %d", userId, sessionKey, type]);
62 }; 62 };
63 63
64 // 登录失败回调 64 // 登录失败回调
65 [LetsGameAPI instance].dismissBlock = ^() { 65 [LetsGameAPI instance].dismissBlock = ^() {
66 NSLog(@"dismiss without login"); 66 NSLog(@"dismiss without login");
67 }; 67 };
68 68
69 ### 5、登录注销 69 ### 5、登录注销
70 注销接口只要设置过appId和appKey之后就不需要设置了,注销完成之后会回到登录界面。FB登录回到登录页面,Gump登录或者游客登录回到登录框。 70 注销接口只要设置过appId和appKey之后就不需要设置了,注销完成之后会回到登录界面。FB登录回到登录页面,Gump登录或者游客登录回到登录框。
71 71
72 [LetsGameAPI instance].appId = @"100";//设置appId 72 [LetsGameAPI instance].appId = @"100";//设置appId
73 [LetsGameAPI instance].appKey = @"100";//设置appkey 73 [LetsGameAPI instance].appKey = @"100";//设置appkey
74 [[LetsGameAPI instance] logout]; //注销 74 [[LetsGameAPI instance] logout]; //注销
75 75
76 76
77 ### 6、第三方支付 77 ### 6、第三方支付
78 [LetsGameAPI instance].appId = @"10022"; 78 [LetsGameAPI instance].appId = @"10022";
79 [LetsGameAPI instance].appKey = @"f899139df5e1059396431415e770c6dd"; 79 [LetsGameAPI instance].appKey = @"f899139df5e1059396431415e770c6dd";
80 NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; 80 NSMutableDictionary *payInfo = [NSMutableDictionary dictionary];
81 [payInfo setValue:@"5001" forKey:@"serverId"];//服务器id,必传参数 81 [payInfo setValue:@"5001" forKey:@"serverId"];//服务器id,必传参数
82 [payInfo setValue:@"10010" forKey:@"roleId"];//用户角色id 82 [payInfo setValue:@"10010" forKey:@"roleId"];//用户角色id
83 [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id 83 [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id
84 [payInfo setValue:@"10" forKey:@"amount"];//金额 84 [payInfo setValue:@"10" forKey:@"amount"];//金额
85 [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//外部订单信息 85 [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//外部订单信息
86 [payInfo setValue:@"元宝" forKey:@"product"];//物品信息 86 [payInfo setValue:@"元宝" forKey:@"product"];//物品信息
87 [payInfo setValue:self.sessionKey forKey:@"sessionKey"];//登录成功的sessionKey 87 [payInfo setValue:self.sessionKey forKey:@"sessionKey"];//登录成功的sessionKey
88 [[LetsGameAPI instance] pay:payInfo handleCallBack:^{ 88 [[LetsGameAPI instance] pay:payInfo handleCallBack:^{
89 //第三方支付完成时的回调(包括支付成功和支付失败,除了支付过程中取消的),取消的不会有回调 89 //第三方支付完成时的回调(包括支付成功和支付失败,除了支付过程中取消的),取消的不会有回调
90 NSLog(@"第三方支付完成"); 90 NSLog(@"第三方支付完成");
91 }]]; 91 }]];
92 92
93 ### 7、IAP支付 93 ### 7、IAP支付
94 若要使用apple IAP支付,需要在AppDelegate的application: didFinishLaunchingWithOptions:方法内注册iap observer,使用如下方法 94 若要使用apple IAP支付,需要在AppDelegate的application: didFinishLaunchingWithOptions:方法内注册iap observer,使用如下方法
95 95
96 [[LetsGameAPI instance] registeIapObserver]; 96 [[LetsGameAPI instance] registeIapObserver];
97 具体调用iap支付的方法如下: 97 具体调用iap支付的方法如下:
98 98
99 [LetsGameAPI instance].appId = @"10022"; 99 [LetsGameAPI instance].appId = @"10022";
100 [LetsGameAPI instance].appKey = @"93a27b0bd99bac3e68a440b48aa421ab"; 100 [LetsGameAPI instance].appKey = @"93a27b0bd99bac3e68a440b48aa421ab";
101 NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; 101 NSMutableDictionary *payInfo = [NSMutableDictionary dictionary];
102 [payInfo setValue:@"5001" forKey:@"serverId"];//当前用户所在的服务器Id 102 [payInfo setValue:@"5001" forKey:@"serverId"];//当前用户所在的服务器Id
103 [payInfo setValue:@"10010" forKey:@"roleId"];//当前用户的角色id 103 [payInfo setValue:@"10010" forKey:@"roleId"];//当前用户的角色id
104 [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id,用于统计 104 [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id,用于统计
105 [payInfo setValue:@"10" forKey:@"amount"];//对应支付项的支付金额,实际支付金额以itunes配置为准 105 [payInfo setValue:@"10" forKey:@"amount"];//对应支付项的支付金额,实际支付金额以itunes配置为准
106 [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//扩展信息,可以游戏自定义,建议传自有订单号 106 [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//扩展信息,可以游戏自定义,建议传自有订单号
107 [payInfo setValue:@"test.product.1" forKey:@"product"];//itunes 后台配置的对应支付项的productId 107 [payInfo setValue:@"test.product.1" forKey:@"product"];//itunes 后台配置的对应支付项的productId
108 [[LetsGameAPI instance] iap:payInfo forUser:@"" succCallback:^(NSString *orderId) { 108 [[LetsGameAPI instance] iap:payInfo forUser:@"" succCallback:^(NSString *orderId) {
109 //此处的回调表明支付已经完成,但此时支付不一定成功,需要服务端验证支付结果 109 //此处的回调表明支付已经完成,但此时支付不一定成功,需要服务端验证支付结果
110 //orderId为gump生成的订单号,此订单号可以在gump server查询此笔支付是否成功 110 //orderId为gump生成的订单号,此订单号可以在gump server查询此笔支付是否成功
111 NSLog(@"IAP completed orderId of Gumptech:%@",orderId); 111 NSLog(@"IAP completed orderId of Gumptech:%@",orderId);
112 } failCallback:^(NSString *orderId) { 112 } failCallback:^(NSString *orderId) {
113 //支付失败 113 //支付失败
114 NSLog(@"IAP file orderId of Gumptech:%@",orderId); 114 NSLog(@"IAP file orderId of Gumptech:%@",orderId);
115 }]; 115 }];
116 ### 8、token的获取 116 ### 8、token的获取
117 FB登录之后会产生token并自动登录,需要如果需要token的话,需要自己调用接口获取。 117 FB登录之后会产生token并自动登录,需要如果需要token的话,需要自己调用接口获取。
118 118
119 //tokenString:token字符串 119 //tokenString:token字符串
120 //refreshTime:refreshTime token最后刷新的时间,即获取的token的时间 120 //refreshTime:refreshTime token最后刷新的时间,即获取的token的时间
121 //expirationTime:expirationTime token最后的有效时间 121 //expirationTime:expirationTime token最后的有效时间
122 [[LetsGameAPI instance] obtainAccessTokenSuccess:^(NSString *tokenString, NSString *refreshTime, NSString *expirationTime) { 122 [[LetsGameAPI instance] obtainAccessTokenSuccess:^(NSString *tokenString, NSString *refreshTime, NSString *expirationTime) {
123 NSLog(@"tokenString %@, refreshTime %@, expirationTime %@", tokenString, refreshTime, expirationTime); 123 NSLog(@"tokenString %@, refreshTime %@, expirationTime %@", tokenString, refreshTime, expirationTime);
124 } failure:^(NSString *errorString) { 124 } failure:^(NSString *errorString) {
125 NSLog(@"get token faile"); 125 NSLog(@"get token faile");
126 }]; 126 }];
127 127
128 128
129 ### 9、第三方支付版本 129 ### 9、第三方支付版本
130 第三方支付,分成两个版本:没有gump币和有gump币,不设置时默认为带gump币版本,如果使用不带gump币的版本如下设置: 130 第三方支付,分成两个版本:没有gump币和有gump币,不设置时默认为带gump币版本,如果使用不带gump币的版本如下设置:
131 131
132 需要在 application:didFinishLaunchingWithOptions方法中添加: 132 需要在 application:didFinishLaunchingWithOptions方法中添加:
133 133
134 [[LetsGameAPI instance] decideWebPayVersion:1] 134 [[LetsGameAPI instance] decideWebPayVersion:1]
135 135
136 136
137 ### 10、关于侵权还是侵权的接口显示 137 ### 10、关于侵权还是侵权的接口显示
138 运营在后台配置此包名和版本在什么时候显示侵权内容还是不侵权内容,此接口调用需要在游戏才开始加载的时候调用,返回值是YES的时候显示侵权内容,在NO的时候显示不侵权内容。 138 运营在后台配置此包名和版本在什么时候显示侵权内容还是不侵权内容,此接口调用需要在游戏才开始加载的时候调用,返回值是YES的时候显示侵权内容,在NO的时候显示不侵权内容。
139 139
140 注意:关于运营配置的游戏的版本号,我们默认取的是Bulid版本号的值,请注意。 140 注意:关于运营配置的游戏的版本号,我们默认取的是Bulid版本号的值,请注意。
141 141
142 [[LetsGameAPI instance] gameObtainSafeSetInfoWithAppId:@"10056" ChannelId:@"1000" handleCallBack:^(BOOL resultStatus) { 142 [[LetsGameAPI instance] gameObtainSafeSetInfoWithAppId:@"10056" ChannelId:@"1000" handleCallBack:^(BOOL resultStatus) {
143 if (resultStatus) { 143 if (resultStatus) {
144 NSLog(@"YES 侵权"); 144 NSLog(@"YES 侵权");
145 }else{ 145 }else{
146 NSLog(@"NO 不侵权"); 146 NSLog(@"NO 不侵权");
147 } 147 }
148 }]; 148 }];
149 149
150 ### 11、微信登陆 150 ### 11、微信登陆
151 151
152 首先在- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;方法中向微信注册应用 152 首先在- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;方法中向微信注册应用
153 //微信登陆 153 //微信登陆
154 [[LetsGameAPI instance] registerAppWeChatWithAppId:@"appId" appKey:@"appKey" Success:^{ 154 [[LetsGameAPI instance] registerAppWeChatWithAppId:@"appId" appKey:@"appKey" Success:^{
155 NSLog(@"注册成功"); 155 NSLog(@"注册成功");
156 } failure:^{ 156 } failure:^{
157 NSLog(@"注册失败"); 157 NSLog(@"注册失败");
158 }]; 158 }];
159 159
ios/GameSDK.framework/Versions/A/GameSDK
No preview for this file type
ios/GameSDK.framework/Versions/A/Headers/LSGAccount.h
1 #import <Foundation/Foundation.h> 1 #import <Foundation/Foundation.h>
2 2
3 typedef NS_ENUM(NSInteger, LSGAccountType) { 3 typedef NS_ENUM(NSInteger, LSGAccountType) {
4 LSGAccountTypeRegist = 1, 4 LSGAccountTypeRegist = 1,
5 LSGAccountTypeFBRegist = 2, 5 LSGAccountTypeFBRegist = 2,
6 LSGAccountTypeQuickRegist = 4, 6 LSGAccountTypeQuickRegist = 4,
7 LSGAccountTypeVKRegist = 8, 7 LSGAccountTypeVKRegist = 8,
8 LSGAccountTypeGoogleRegist = 16, 8 LSGAccountTypeGoogleRegist = 16,
9 LSGAccountTypeWeChatRegist = 32, 9 LSGAccountTypeWeChatRegist = 32,
10 LSGAccountTypeLineRegist = 64,
10 }; 11 };
11 12
12 //判断是不是自动登录情况 13 //判断是不是自动登录情况
13 #define LSGAccountTypeBaseLogin 64 14 #define LSGAccountTypeBaseLogin 128
14 15
15 @interface LSGAccount : NSObject 16 @interface LSGAccount : NSObject
16 17
17 @property(nonatomic, assign) LSGAccountType type; 18 @property(nonatomic, assign) LSGAccountType type;
18 @property(nonatomic, strong) NSString *username; 19 @property(nonatomic, strong) NSString *username;
19 @property(nonatomic, strong) NSString *nickName; 20 @property(nonatomic, strong) NSString *nickName;
20 @property(nonatomic, strong) NSString *password; 21 @property(nonatomic, strong) NSString *password;
21 @property(nonatomic, strong) NSString *userId; 22 @property(nonatomic, strong) NSString *userId;
22 @property(nonatomic, strong) NSString *sessionKey; 23 @property(nonatomic, strong) NSString *sessionKey;
23 @property(nonatomic, strong) NSString *deviceId; 24 @property(nonatomic, strong) NSString *deviceId;
24 25
25 + (void)saveAccount:(NSString *)service account:(LSGAccount *)account; 26 + (void)saveAccount:(NSString *)service account:(LSGAccount *)account;
26 27
27 + (LSGAccount *)loadAccount:(NSString *)service; 28 + (LSGAccount *)loadAccount:(NSString *)service;
28 29
29 + (void)deleteAccount:(NSString *)service; 30 + (void)deleteAccount:(NSString *)service;
30 31
31 @end 32 @end
32 33
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 isEnableWeChat = YES; 14 static BOOL isDisableLine = NO;
15
16 static BOOL isDisableWeChat = NO;
15 17
16 static BOOL isDisableGoogle = NO; 18 static BOOL isDisableGoogle = NO;
17 19
18 static BOOL hiddenLogo = NO; 20 static BOOL hiddenLogo = NO;
19 21
20 static NSString *version = @"3.4.9"; 22 static NSString *version = @"3.4.11";
21 23
22 @interface LetsGameAPI : NSObject<UIApplicationDelegate> 24 @interface LetsGameAPI : NSObject<UIApplicationDelegate>
23 25
24 @property (nonatomic, strong) NSString *appId; 26 @property (nonatomic, strong) NSString *appId;
25 @property (nonatomic, strong) NSString *appKey; 27 @property (nonatomic, strong) NSString *appKey;
26 @property (nonatomic, copy) LSGLoginSuccBlock succBlock; 28 @property (nonatomic, copy) LSGLoginSuccBlock succBlock;
27 @property (nonatomic, copy) LSGDismissBlock dismissBlock; 29 @property (nonatomic, copy) LSGDismissBlock dismissBlock;
28 @property (nonatomic, assign) int isDebug; 30 @property (nonatomic, assign) int isDebug;
29 @property (nonatomic, assign) int decideWebPay; 31 @property (nonatomic, assign) int decideWebPay;
30 @property (nonatomic,retain) id<VKBridgeProtocol> vkBridge; 32 @property (nonatomic,retain) id<VKBridgeProtocol> vkBridge;
31 //@property(nonatomic,strong) NSString *version; 33 //@property(nonatomic,strong) NSString *version;
32 34
33 + (instancetype)instance; 35 + (instancetype)instance;
34 36
35 -(NSString*)version; 37 -(NSString*)version;
36 38
37 - (void)showLoginView; 39 - (void)showLoginView;
38 - (void)showLoginViewInView:(UIView *)view; 40 - (void)showLoginViewInView:(UIView *)view;
39 41
40 +(void)disableFB:(BOOL)isDisable; 42 +(void)disableFB:(BOOL)isDisable;
41 +(void)disableGoogle:(BOOL)isDisable; 43 +(void)disableGoogle:(BOOL)isDisable;
44 +(void)disableWeChat:(BOOL)isDisable;
45 +(void)disableLine:(BOOL)isDissable;
42 +(BOOL)isFBDisable; 46 +(BOOL)isFBDisable;
43 +(BOOL)isVKEnable; 47 +(BOOL)isVKEnable;
44 +(BOOL)isWeChatEnable; 48 +(BOOL)isWeChatDisable;
45 +(BOOL)isGoogleDisable; 49 +(BOOL)isGoogleDisable;
50 +(BOOL)isLineDisable;
46 +(void)hiddenLogo:(BOOL)isHidden; 51 +(void)hiddenLogo:(BOOL)isHidden;
47 +(BOOL)isHiddenLogo; 52 +(BOOL)isHiddenLogo;
48 53
49 - (void)logout; 54 - (void)logout;
50 55
51 - (void)hide; 56 - (void)hide;
52 //是否安装微信 57 //是否安装微信
53 -(BOOL)isWeChatInstall; 58 -(BOOL)isWeChatInstall;
54 //向微信注册应用 59 //向微信注册应用
55 -(void)registerAppWeChatWithAppId:(NSString *)appId 60 -(void)registerAppWeChatWithAppId:(NSString *)appId
56 appKey:(NSString *)appKey 61 appKey:(NSString *)appKey
57 Success:(void (^)())success 62 Success:(void (^)())success
58 failure:(void (^)())failure; 63 failure:(void (^)())failure;
59 64
60 - (BOOL)handleOpenURL:(NSURL *)url 65 - (BOOL)handleOpenURL:(NSURL *)url
61 sourceApplication:(NSString *)sourceApplication; 66 sourceApplication:(NSString *)sourceApplication;
62 67
63 -(void)pay:(NSDictionary*) payInfo handleCallBack:(void (^)()) payAccomplistCallback; 68 -(void)pay:(NSDictionary*) payInfo handleCallBack:(void (^)()) payAccomplistCallback;
64 69
65 //-(void)iap:(NSDictionary*) payInfo forUser:(NSString*) uid handleCallback:(void (^)(NSString* orderId)) callback; 70 //-(void)iap:(NSDictionary*) payInfo forUser:(NSString*) uid handleCallback:(void (^)(NSString* orderId)) callback;
66 71
67 -(void)iap:(NSDictionary*) payInfo forUser:(NSString*) uid succCallback:(void (^)(NSString* orderId)) succCallback failCallback:(void (^)(NSString* orderId)) failCallback; 72 -(void)iap:(NSDictionary*) payInfo forUser:(NSString*) uid succCallback:(void (^)(NSString* orderId)) succCallback failCallback:(void (^)(NSString* orderId)) failCallback;
68 73
69 -(void)registeIapObserver; 74 -(void)registeIapObserver;
70 75
71 -(void)decideIsDebug:(int)isDebug; 76 -(void)decideIsDebug:(int)isDebug;
72 77
73 -(void)decideWebPayVersion:(int)decideWebPay; 78 -(void)decideWebPayVersion:(int)decideWebPay;
74 79
75 -(void)obtainAccessTokenSuccess:(void (^)(NSString *tokenString, NSString *refreshTime, NSString *expirationTime))success 80 -(void)obtainAccessTokenSuccess:(void (^)(NSString *tokenString, NSString *refreshTime, NSString *expirationTime))success
76 failure:(void (^)(NSString *errorString))failure; 81 failure:(void (^)(NSString *errorString))failure;
77 82
78 //获取是否展示安全页面,YES展示侵权页面,NO展示非侵权页面 83 //获取是否展示安全页面,YES展示侵权页面,NO展示非侵权页面
79 -(void)gameObtainSafeSetInfoWithAppId:(NSString *)appId 84 -(void)gameObtainSafeSetInfoWithAppId:(NSString *)appId
80 ChannelId:(NSString *)channelId 85 ChannelId:(NSString *)channelId
81 handleCallBack:(void (^)(BOOL resultStatus))callBack; 86 handleCallBack:(void (^)(BOOL resultStatus))callBack;
82 @end 87 @end
83 88
No preview for this file type
ios/GameSDKDemo/GameSDKDemo.xcodeproj/project.xcworkspace/xcuserdata/yanglele.xcuserdatad/UserInterfaceState.xcuserstate
No preview for this file type
ios/GameSDKDemo/GameSDKDemo.xcodeproj/xcuserdata/yanglele.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 <Bucket 2 <Bucket
3 type = "1" 3 type = "1"
4 version = "2.0"> 4 version = "2.0">
5 <Breakpoints> 5 <Breakpoints>
6 <BreakpointProxy 6 <BreakpointProxy
7 BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> 7 BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
8 <BreakpointContent 8 <BreakpointContent
9 shouldBeEnabled = "Yes" 9 shouldBeEnabled = "Yes"
10 ignoreCount = "0" 10 ignoreCount = "0"
11 continueAfterRunningActions = "No" 11 continueAfterRunningActions = "No"
12 filePath = "../../../iosgamesdk/GameSDK/letsgame/service/httpService/LSGUserService.m" 12 filePath = "../../../iosgamesdk/GameSDK/letsgame/service/httpService/LSGUserService.m"
13 timestampString = "536050010.070926" 13 timestampString = "536217870.40553"
14 startingColumnNumber = "9223372036854775807" 14 startingColumnNumber = "9223372036854775807"
15 endingColumnNumber = "9223372036854775807" 15 endingColumnNumber = "9223372036854775807"
16 startingLineNumber = "594" 16 startingLineNumber = "594"
17 endingLineNumber = "594" 17 endingLineNumber = "594"
18 landmarkName = "-appObtainWeCharAppIDWithAppId:appKey:result:" 18 landmarkName = "-appObtainWeCharAppIDWithAppId:appKey:result:"
19 landmarkType = "7"> 19 landmarkType = "7">
20 </BreakpointContent> 20 </BreakpointContent>
21 </BreakpointProxy> 21 </BreakpointProxy>
22 <BreakpointProxy 22 <BreakpointProxy
23 BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> 23 BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
24 <BreakpointContent 24 <BreakpointContent
25 shouldBeEnabled = "Yes" 25 shouldBeEnabled = "Yes"
26 ignoreCount = "0" 26 ignoreCount = "0"
27 continueAfterRunningActions = "No" 27 continueAfterRunningActions = "No"
28 filePath = "../../../iosgamesdk/GameSDK/letsgame/registAndLogin/LSGUserBaseViewController.m"
29 timestampString = "536046478.994249"
30 startingColumnNumber = "9223372036854775807"
31 endingColumnNumber = "9223372036854775807"
32 startingLineNumber = "295"
33 endingLineNumber = "295"
34 landmarkName = "-onClickWeChatLogin"
35 landmarkType = "7">
36 </BreakpointContent>
37 </BreakpointProxy>
38 <BreakpointProxy
39 BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
40 <BreakpointContent
41 shouldBeEnabled = "Yes"
42 ignoreCount = "0"
43 continueAfterRunningActions = "No"
44 filePath = "../../../iosgamesdk/GameSDK/letsgame/LetsGameAPI.m" 28 filePath = "../../../iosgamesdk/GameSDK/letsgame/LetsGameAPI.m"
45 timestampString = "536050715.666746" 29 timestampString = "536126823.106813"
46 startingColumnNumber = "9223372036854775807" 30 startingColumnNumber = "9223372036854775807"
47 endingColumnNumber = "9223372036854775807" 31 endingColumnNumber = "9223372036854775807"
48 startingLineNumber = "269" 32 startingLineNumber = "281"
49 endingLineNumber = "269" 33 endingLineNumber = "281"
50 landmarkName = "-registerAppWeChatWithAppId:appKey:Success:failure:" 34 landmarkName = "-registerAppWeChatWithAppId:appKey:Success:failure:"
51 landmarkType = "7"> 35 landmarkType = "7">
52 <Locations> 36 <Locations>
53 <Location 37 <Location
54 shouldBeEnabled = "Yes" 38 shouldBeEnabled = "Yes"
55 ignoreCount = "0" 39 ignoreCount = "0"
56 continueAfterRunningActions = "No" 40 continueAfterRunningActions = "No"
57 symbolName = "-[LetsGameAPI registerAppWeChatWithAppId:appKey:Success:failure:]" 41 symbolName = "-[LetsGameAPI registerAppWeChatWithAppId:appKey:Success:failure:]"
58 moduleName = "GameSDKDemo" 42 moduleName = "GameSDKDemo"
59 usesParentBreakpointCondition = "Yes" 43 usesParentBreakpointCondition = "Yes"
60 urlString = "file:///Users/yanglele/workproject/project/GumpSDK/iosgamesdk/GameSDK/letsgame/LetsGameAPI.m" 44 urlString = "file:///Users/yanglele/workproject/project/GumpSDK/iosgamesdk/GameSDK/letsgame/LetsGameAPI.m"
61 timestampString = "536048775.543027" 45 timestampString = "536212412.523702"
62 startingColumnNumber = "9223372036854775807" 46 startingColumnNumber = "9223372036854775807"
63 endingColumnNumber = "9223372036854775807" 47 endingColumnNumber = "9223372036854775807"
64 startingLineNumber = "269" 48 startingLineNumber = "281"
65 endingLineNumber = "269" 49 endingLineNumber = "281"
66 offsetFromSymbolStart = "164"> 50 offsetFromSymbolStart = "161">
67 </Location> 51 </Location>
68 <Location 52 <Location
69 shouldBeEnabled = "Yes" 53 shouldBeEnabled = "Yes"
70 ignoreCount = "0" 54 ignoreCount = "0"
71 continueAfterRunningActions = "No" 55 continueAfterRunningActions = "No"
72 symbolName = "__65-[LetsGameAPI registerAppWeChatWithAppId:appKey:Success:failure:]_block_invoke" 56 symbolName = "__65-[LetsGameAPI registerAppWeChatWithAppId:appKey:Success:failure:]_block_invoke"
73 moduleName = "GameSDKDemo" 57 moduleName = "GameSDKDemo"
74 usesParentBreakpointCondition = "Yes" 58 usesParentBreakpointCondition = "Yes"
75 urlString = "file:///Users/yanglele/workproject/project/GumpSDK/iosgamesdk/GameSDK/letsgame/LetsGameAPI.m" 59 urlString = "file:///Users/yanglele/workproject/project/GumpSDK/iosgamesdk/GameSDK/letsgame/LetsGameAPI.m"
76 timestampString = "536048775.545047" 60 timestampString = "536212412.526449"
77 startingColumnNumber = "9223372036854775807" 61 startingColumnNumber = "9223372036854775807"
78 endingColumnNumber = "9223372036854775807" 62 endingColumnNumber = "9223372036854775807"
79 startingLineNumber = "269" 63 startingLineNumber = "281"
80 endingLineNumber = "269" 64 endingLineNumber = "281"
81 offsetFromSymbolStart = "16"> 65 offsetFromSymbolStart = "19">
82 </Location> 66 </Location>
83 </Locations> 67 </Locations>
84 </BreakpointContent> 68 </BreakpointContent>
85 </BreakpointProxy> 69 </BreakpointProxy>
86 <BreakpointProxy 70 <BreakpointProxy
87 BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> 71 BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
88 <BreakpointContent 72 <BreakpointContent
89 shouldBeEnabled = "Yes" 73 shouldBeEnabled = "Yes"
90 ignoreCount = "0" 74 ignoreCount = "0"
91 continueAfterRunningActions = "No" 75 continueAfterRunningActions = "No"
92 filePath = "../../../iosgamesdk/GameSDK/letsgame/registAndLogin/LSGWeChatViewController.m" 76 filePath = "../../../iosgamesdk/GameSDK/letsgame/registAndLogin/LSGWeChatViewController.m"
93 timestampString = "536048532.37555" 77 timestampString = "536126480.108287"
94 startingColumnNumber = "9223372036854775807" 78 startingColumnNumber = "9223372036854775807"
95 endingColumnNumber = "9223372036854775807" 79 endingColumnNumber = "9223372036854775807"
96 startingLineNumber = "51" 80 startingLineNumber = "51"
97 endingLineNumber = "51" 81 endingLineNumber = "51"
98 landmarkName = "-registerAppWeChatAppIDWithAppId:appKey:success:failure:" 82 landmarkName = "-registerAppWeChatAppIDWithAppId:appKey:success:failure:"
99 landmarkType = "7"> 83 landmarkType = "7">
100 <Locations> 84 <Locations>
101 <Location 85 <Location
102 shouldBeEnabled = "Yes" 86 shouldBeEnabled = "Yes"
103 ignoreCount = "0" 87 ignoreCount = "0"
104 continueAfterRunningActions = "No" 88 continueAfterRunningActions = "No"
105 symbolName = "-[LSGWeChatViewController registerAppWeChatAppIDWithAppId:appKey:success:failure:]" 89 symbolName = "-[LSGWeChatViewController registerAppWeChatAppIDWithAppId:appKey:success:failure:]"
106 moduleName = "GameSDKDemo" 90 moduleName = "GameSDKDemo"
107 usesParentBreakpointCondition = "Yes" 91 usesParentBreakpointCondition = "Yes"
108 urlString = "file:///Users/yanglele/workproject/project/GumpSDK/iosgamesdk/GameSDK/letsgame/registAndLogin/LSGWeChatViewController.m" 92 urlString = "file:///Users/yanglele/workproject/project/GumpSDK/iosgamesdk/GameSDK/letsgame/registAndLogin/LSGWeChatViewController.m"
109 timestampString = "536048775.551058" 93 timestampString = "536212412.554201"
110 startingColumnNumber = "9223372036854775807" 94 startingColumnNumber = "9223372036854775807"
111 endingColumnNumber = "9223372036854775807" 95 endingColumnNumber = "9223372036854775807"
112 startingLineNumber = "51" 96 startingLineNumber = "51"
113 endingLineNumber = "51" 97 endingLineNumber = "51"
114 offsetFromSymbolStart = "224"> 98 offsetFromSymbolStart = "201">
115 </Location> 99 </Location>
116 <Location 100 <Location
117 shouldBeEnabled = "Yes" 101 shouldBeEnabled = "Yes"
118 ignoreCount = "0" 102 ignoreCount = "0"
119 continueAfterRunningActions = "No" 103 continueAfterRunningActions = "No"
120 symbolName = "__82-[LSGWeChatViewController registerAppWeChatAppIDWithAppId:appKey:success:failure:]_block_invoke" 104 symbolName = "__82-[LSGWeChatViewController registerAppWeChatAppIDWithAppId:appKey:success:failure:]_block_invoke"
121 moduleName = "GameSDKDemo" 105 moduleName = "GameSDKDemo"
122 usesParentBreakpointCondition = "Yes" 106 usesParentBreakpointCondition = "Yes"
123 urlString = "file:///Users/yanglele/workproject/project/GumpSDK/iosgamesdk/GameSDK/letsgame/registAndLogin/LSGWeChatViewController.m" 107 urlString = "file:///Users/yanglele/workproject/project/GumpSDK/iosgamesdk/GameSDK/letsgame/registAndLogin/LSGWeChatViewController.m"
124 timestampString = "536048775.553805" 108 timestampString = "536212412.557216"
125 startingColumnNumber = "9223372036854775807" 109 startingColumnNumber = "9223372036854775807"
126 endingColumnNumber = "9223372036854775807" 110 endingColumnNumber = "9223372036854775807"
127 startingLineNumber = "52" 111 startingLineNumber = "52"
128 endingLineNumber = "52" 112 endingLineNumber = "52"
129 offsetFromSymbolStart = "64"> 113 offsetFromSymbolStart = "44">
130 </Location> 114 </Location>
131 </Locations> 115 </Locations>
132 </BreakpointContent> 116 </BreakpointContent>
133 </BreakpointProxy> 117 </BreakpointProxy>
134 <BreakpointProxy 118 <BreakpointProxy
135 BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> 119 BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
136 <BreakpointContent 120 <BreakpointContent
137 shouldBeEnabled = "Yes" 121 shouldBeEnabled = "Yes"
138 ignoreCount = "0" 122 ignoreCount = "0"
139 continueAfterRunningActions = "No" 123 continueAfterRunningActions = "No"
140 filePath = "../../../iosgamesdk/GameSDK/letsgame/registAndLogin/LSGWeChatViewController.m" 124 filePath = "../../../iosgamesdk/GameSDK/letsgame/registAndLogin/LSGWeChatViewController.m"
141 timestampString = "536048532.37562" 125 timestampString = "536126480.108348"
142 startingColumnNumber = "9223372036854775807" 126 startingColumnNumber = "9223372036854775807"
143 endingColumnNumber = "9223372036854775807" 127 endingColumnNumber = "9223372036854775807"
144 startingLineNumber = "34" 128 startingLineNumber = "34"
145 endingLineNumber = "34" 129 endingLineNumber = "34"
146 landmarkName = "+isWeChatInstall" 130 landmarkName = "+isWeChatInstall"
147 landmarkType = "7"> 131 landmarkType = "7">
148 </BreakpointContent> 132 </BreakpointContent>
149 </BreakpointProxy> 133 </BreakpointProxy>
150 <BreakpointProxy 134 <BreakpointProxy
151 BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> 135 BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
152 <BreakpointContent 136 <BreakpointContent
153 shouldBeEnabled = "Yes" 137 shouldBeEnabled = "Yes"
154 ignoreCount = "0" 138 ignoreCount = "0"
155 continueAfterRunningActions = "No" 139 continueAfterRunningActions = "No"
156 filePath = "letsgameDemo/LSGAppDelegate.m" 140 filePath = "../../../iosgamesdk/GameSDK/letsgame/registAndLogin/LSGFBLoginViewController.m"
157 timestampString = "536050715.667074" 141 timestampString = "536127479.611329"
158 startingColumnNumber = "9223372036854775807" 142 startingColumnNumber = "9223372036854775807"
159 endingColumnNumber = "9223372036854775807" 143 endingColumnNumber = "9223372036854775807"
160 startingLineNumber = "38" 144 startingLineNumber = "68"
161 endingLineNumber = "38" 145 endingLineNumber = "68"
162 landmarkName = "-application:didFinishLaunchingWithOptions:" 146 landmarkName = "-injectJSObject"
147 landmarkType = "7">
148 </BreakpointContent>
149 </BreakpointProxy>
150 <BreakpointProxy
151 BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
152 <BreakpointContent
153 shouldBeEnabled = "Yes"
154 ignoreCount = "0"
155 continueAfterRunningActions = "No"
156 filePath = "../../../iosgamesdk/GameSDK/letsgame/registAndLogin/LSGFBLoginViewController.m"
157 timestampString = "536127479.611763"
158 startingColumnNumber = "9223372036854775807"
159 endingColumnNumber = "9223372036854775807"
160 startingLineNumber = "31"
161 endingLineNumber = "31"
162 landmarkName = "-loadView"
163 landmarkType = "7">
164 </BreakpointContent>
165 </BreakpointProxy>
166 <BreakpointProxy
167 BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
168 <BreakpointContent
169 shouldBeEnabled = "Yes"
170 ignoreCount = "0"
171 continueAfterRunningActions = "No"
172 filePath = "../../../iosgamesdk/GameSDK/letsgame/registAndLogin/LSGFBLoginViewController.m"
173 timestampString = "536127479.61203"
174 startingColumnNumber = "9223372036854775807"
175 endingColumnNumber = "9223372036854775807"
176 startingLineNumber = "93"
177 endingLineNumber = "93"
178 landmarkName = "-webViewDidFinishLoad:"
179 landmarkType = "7">
180 </BreakpointContent>
181 </BreakpointProxy>
182 <BreakpointProxy
183 BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
184 <BreakpointContent
185 shouldBeEnabled = "Yes"
186 ignoreCount = "0"
187 continueAfterRunningActions = "No"
188 filePath = "../../../iosgamesdk/GameSDK/letsgame/registAndLogin/LSGFBLoginViewController.m"
189 timestampString = "536127479.61231"
190 startingColumnNumber = "9223372036854775807"
191 endingColumnNumber = "9223372036854775807"
192 startingLineNumber = "102"
193 endingLineNumber = "102"
194 landmarkName = "-webView:shouldStartLoadWithRequest:navigationType:"
195 landmarkType = "7">
196 </BreakpointContent>
197 </BreakpointProxy>
198 <BreakpointProxy
199 BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
200 <BreakpointContent
ios/GameSDKDemo/letsgameDemo/LSGAppDelegate.m
1 // 1 //
2 // LSGAppDelegate.m 2 // LSGAppDelegate.m
3 // letsgameDemo 3 // letsgameDemo
4 // 4 //
5 // Created by zhy on 14-5-24. 5 // Created by zhy on 14-5-24.
6 // 6 //
7 // 7 //
8 8
9 #import "LSGAppDelegate.h" 9 #import "LSGAppDelegate.h"
10 #import "LSGMainViewController.h" 10 #import "LSGMainViewController.h"
11 #import "LetsGameAPI.h" 11 #import "LetsGameAPI.h"
12 12
13 @implementation LSGAppDelegate 13 @implementation LSGAppDelegate
14 14
15 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 15 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
16 { 16 {
17 self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 17 self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
18 18
19 LSGMainViewController *viewController = [[LSGMainViewController alloc] init]; 19 LSGMainViewController *viewController = [[LSGMainViewController alloc] init];
20 self.window.rootViewController = viewController; 20 self.window.rootViewController = viewController;
21 [self.window addSubview:viewController.view]; 21 [self.window addSubview:viewController.view];
22 22
23 self.window.backgroundColor = [UIColor whiteColor]; 23 self.window.backgroundColor = [UIColor whiteColor];
24 [self.window makeKeyAndVisible]; 24 [self.window makeKeyAndVisible];
25 25
26 [[LetsGameAPI instance] decideIsDebug:1]; 26 // [[LetsGameAPI instance] decideIsDebug:1];
27 27
28 //显示是否侵权的接口 28 //显示是否侵权的接口
29 // [[LetsGameAPI instance] gameObtainSafeSetInfoWithAppId:@"10056" ChannelId:@"1000" handleCallBack:^(BOOL resultStatus) { 29 // [[LetsGameAPI instance] gameObtainSafeSetInfoWithAppId:@"10056" ChannelId:@"1000" handleCallBack:^(BOOL resultStatus) {
30 // if (resultStatus) { 30 // if (resultStatus) {
31 // NSLog(@"YES 侵权"); 31 // NSLog(@"YES 侵权");
32 // }else{ 32 // }else{
33 // NSLog(@"NO 不侵权"); 33 // NSLog(@"NO 不侵权");
34 // } 34 // }
35 // }]; 35 // }];
36 36
37 //微信登陆 37 //微信登陆
38 [[LetsGameAPI instance] registerAppWeChatWithAppId:@"100" appKey:@"f899139df5e1059396431415e770c6dd" Success:^{ 38 // [[LetsGameAPI instance] registerAppWeChatWithAppId:@"100" appKey:@"f899139df5e1059396431415e770c6dd" Success:^{
39 NSLog(@"注册成功"); 39 // NSLog(@"注册成功");
40 } failure:^{ 40 // } failure:^{
41 NSLog(@"注册失败"); 41 // NSLog(@"注册失败");
42 }]; 42 // }];
43 43
44 [[UIApplication sharedApplication] setStatusBarHidden:YES]; 44 [[UIApplication sharedApplication] setStatusBarHidden:YES];
45 [[LetsGameAPI instance] registeIapObserver]; 45 [[LetsGameAPI instance] registeIapObserver];
46 46
47 return YES; 47 return YES;
48 } 48 }
49 49
50 - (void)applicationWillResignActive:(UIApplication *)application 50 - (void)applicationWillResignActive:(UIApplication *)application
51 { 51 {
52 // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 52 // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
53 // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 53 // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
54 } 54 }
55 55
56 - (void)applicationDidEnterBackground:(UIApplication *)application 56 - (void)applicationDidEnterBackground:(UIApplication *)application
57 { 57 {
58 // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 58 // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
59 // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 59 // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
60 } 60 }
61 61
62 - (void)applicationWillEnterForeground:(UIApplication *)application 62 - (void)applicationWillEnterForeground:(UIApplication *)application
63 { 63 {
64 // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 64 // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
65 } 65 }
66 66
67 -(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{ 67 -(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{
68 return [[LetsGameAPI instance] handleOpenURL:url sourceApplication:sourceApplication]; 68 return [[LetsGameAPI instance] handleOpenURL:url sourceApplication:sourceApplication];
69 //return [[LetsGameAPI instance].vkBridge processOpenURL:url fromApplication:sourceApplication]; 69 //return [[LetsGameAPI instance].vkBridge processOpenURL:url fromApplication:sourceApplication];
70 } 70 }
71 71
72 72
73 @end 73 @end
74 74
ios/GameSDKDemo/letsgameDemo/LSGMainViewController.m
1 // 1 //
2 // LSGMainViewController.m 2 // LSGMainViewController.m
3 // letsgameDemo 3 // letsgameDemo
4 // 4 //
5 // Created by zhy on 14-5-24. 5 // Created by zhy on 14-5-24.
6 // 6 //
7 // 7 //
8 8
9 #import "LSGMainViewController.h" 9 #import "LSGMainViewController.h"
10 #import "LetsGameAPI.h" 10 #import "LetsGameAPI.h"
11 #import "VKBridge.h" 11 #import "VKBridge.h"
12 12
13 13
14 @interface LSGMainViewController () 14 @interface LSGMainViewController ()
15 15
16 @property (nonatomic, strong) UILabel *resultLabel; 16 @property (nonatomic, strong) UILabel *resultLabel;
17 17
18 @property(nonatomic,strong) UIButton *vkActivityShareBtn; 18 @property(nonatomic,strong) UIButton *vkActivityShareBtn;
19 19
20 @property(nonatomic,copy) NSString *sessionKey; 20 @property(nonatomic,copy) NSString *sessionKey;
21 @end 21 @end
22 22
23 @implementation LSGMainViewController 23 @implementation LSGMainViewController
24 24
25 - (void)loadView { 25 - (void)loadView {
26 [super loadView]; 26 [super loadView];
27 NSLog(@"i come in"); 27 NSLog(@"i come in");
28 self.view.backgroundColor = [UIColor whiteColor]; 28 self.view.backgroundColor = [UIColor whiteColor];
29 // self.view.backgroundColor = [UIColor blackColor]; 29 // self.view.backgroundColor = [UIColor blackColor];
30 30
31 UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(110, 40, 100, 30)]; 31 UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(110, 40, 100, 30)];
32 btn.backgroundColor = [UIColor orangeColor]; 32 btn.backgroundColor = [UIColor orangeColor];
33 [btn setTitle:@"测试入口" forState:UIControlStateNormal]; 33 [btn setTitle:@"测试入口" forState:UIControlStateNormal];
34 [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 34 [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
35 btn.titleLabel.font = [UIFont systemFontOfSize:15]; 35 btn.titleLabel.font = [UIFont systemFontOfSize:15];
36 [btn addTarget:self action:@selector(onClickTest) forControlEvents:UIControlEventTouchUpInside]; 36 [btn addTarget:self action:@selector(onClickTest) forControlEvents:UIControlEventTouchUpInside];
37 [self.view addSubview:btn]; 37 [self.view addSubview:btn];
38 38
39 39
40 40
41 UIButton *bindtn = [[UIButton alloc] initWithFrame:CGRectMake(110, 100, 100, 30)]; 41 UIButton *bindtn = [[UIButton alloc] initWithFrame:CGRectMake(110, 100, 100, 30)];
42 bindtn.backgroundColor = [UIColor orangeColor]; 42 bindtn.backgroundColor = [UIColor orangeColor];
43 [bindtn setTitle:@"退出账号" forState:UIControlStateNormal]; 43 [bindtn setTitle:@"退出账号" forState:UIControlStateNormal];
44 [bindtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 44 [bindtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
45 bindtn.titleLabel.font = [UIFont systemFontOfSize:15]; 45 bindtn.titleLabel.font = [UIFont systemFontOfSize:15];
46 [bindtn addTarget:self action:@selector(onLogoutTest) forControlEvents:UIControlEventTouchUpInside]; 46 [bindtn addTarget:self action:@selector(onLogoutTest) forControlEvents:UIControlEventTouchUpInside];
47 [self.view addSubview:bindtn]; 47 [self.view addSubview:bindtn];
48 48
49 UIButton *payBtn = [[UIButton alloc] initWithFrame:CGRectMake(110, 160, 100, 30)]; 49 UIButton *payBtn = [[UIButton alloc] initWithFrame:CGRectMake(110, 160, 100, 30)];
50 payBtn.backgroundColor = [UIColor orangeColor]; 50 payBtn.backgroundColor = [UIColor orangeColor];
51 [payBtn setTitle:@"支付" forState:UIControlStateNormal]; 51 [payBtn setTitle:@"支付" forState:UIControlStateNormal];
52 [payBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 52 [payBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
53 payBtn.titleLabel.font = [UIFont systemFontOfSize:15]; 53 payBtn.titleLabel.font = [UIFont systemFontOfSize:15];
54 [payBtn addTarget:self action:@selector(onPayTest) forControlEvents:UIControlEventTouchUpInside]; 54 [payBtn addTarget:self action:@selector(onPayTest) forControlEvents:UIControlEventTouchUpInside];
55 [self.view addSubview:payBtn]; 55 [self.view addSubview:payBtn];
56 56
57 UIButton *iapBtn = [[UIButton alloc] initWithFrame:CGRectMake(110, 220, 100, 30)]; 57 UIButton *iapBtn = [[UIButton alloc] initWithFrame:CGRectMake(110, 220, 100, 30)];
58 iapBtn.backgroundColor = [UIColor orangeColor]; 58 iapBtn.backgroundColor = [UIColor orangeColor];
59 [iapBtn setTitle:@"IAP" forState:UIControlStateNormal]; 59 [iapBtn setTitle:@"IAP" forState:UIControlStateNormal];
60 [iapBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 60 [iapBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
61 iapBtn.titleLabel.font = [UIFont systemFontOfSize:15]; 61 iapBtn.titleLabel.font = [UIFont systemFontOfSize:15];
62 [iapBtn addTarget:self action:@selector(onIapTest) forControlEvents:UIControlEventTouchUpInside]; 62 [iapBtn addTarget:self action:@selector(onIapTest) forControlEvents:UIControlEventTouchUpInside];
63 [self.view addSubview:iapBtn]; 63 [self.view addSubview:iapBtn];
64 64
65 } 65 }
66 66
67 - (UILabel *)resultLabel { 67 - (UILabel *)resultLabel {
68 if (!_resultLabel) { 68 if (!_resultLabel) {
69 _resultLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.view.frame) - 90, self.view.frame.size.width, 60)]; 69 _resultLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.view.frame) - 90, self.view.frame.size.width, 60)];
70 _resultLabel.backgroundColor = [UIColor clearColor]; 70 _resultLabel.backgroundColor = [UIColor clearColor];
71 _resultLabel.textAlignment = NSTextAlignmentCenter; 71 _resultLabel.textAlignment = NSTextAlignmentCenter;
72 _resultLabel.textColor = [UIColor redColor]; 72 _resultLabel.textColor = [UIColor redColor];
73 _resultLabel.font = [UIFont systemFontOfSize:15]; 73 _resultLabel.font = [UIFont systemFontOfSize:15];
74 _resultLabel.numberOfLines = 4; 74 _resultLabel.numberOfLines = 4;
75 _resultLabel.lineBreakMode = NSLineBreakByWordWrapping; 75 _resultLabel.lineBreakMode = NSLineBreakByWordWrapping;
76 [self.view addSubview:_resultLabel]; 76 [self.view addSubview:_resultLabel];
77 } 77 }
78 78
79 return _resultLabel; 79 return _resultLabel;
80 } 80 }
81 81
82 82
83 - (void)onClickTest { 83 - (void)onClickTest {
84 84
85 [LetsGameAPI instance].appId = @"10056";//10047 85 [LetsGameAPI instance].appId = @"100";//@"100";//10047
86 [LetsGameAPI instance].appKey = @"b59c21a078fde074a6750e91ed19fb21";//eccd9f7dc92858b741132fda313130cf 86 [LetsGameAPI instance].appKey = @"b59c21a078fde074a6750e91ed19fb21";//@"f899139df5e1059396431415e770c6dd";//eccd9f7dc92858b741132fda313130cf
87 [LetsGameAPI hiddenLogo:YES]; 87 [LetsGameAPI hiddenLogo:YES];
88 // [LetsGameAPI disableFB:YES]; 88 [LetsGameAPI disableFB:YES];
89 // [LetsGameAPI disableGoogle:YES]; 89 [LetsGameAPI disableGoogle:YES];
90 // [LetsGameAPI disableLine:YES];
90 NSLog(@"sdk version:%@",[[LetsGameAPI instance] version]); 91 NSLog(@"sdk version:%@",[[LetsGameAPI instance] version]);
91 //启用vk登录 92 //启用vk登录
92 VKBridge *vkBridge = [[VKBridge alloc] initWithVKAppId:@"5029792"]; 93 VKBridge *vkBridge = [[VKBridge alloc] initWithVKAppId:@"5029792"];
93 [LetsGameAPI instance].vkBridge = vkBridge; 94 [LetsGameAPI instance].vkBridge = vkBridge;
94 95
95 [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) { 96 [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) {
96 self.sessionKey = sessionKey; 97 self.sessionKey = sessionKey;
97 self.resultLabel.text = [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %ld", userId, sessionKey, type]; 98 self.resultLabel.text = [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %ld", userId, sessionKey, type];
98 }; 99 };
99 [LetsGameAPI instance].dismissBlock = ^() { 100 [LetsGameAPI instance].dismissBlock = ^() {
100 self.resultLabel.text = @"dismiss without login"; 101 self.resultLabel.text = @"dismiss without login";
101 }; 102 };
102 103
103 [[LetsGameAPI instance] showLoginView]; 104 [[LetsGameAPI instance] showLoginView];
104 } 105 }
105 106
106 107
107 - (void)onLogoutTest { 108 - (void)onLogoutTest {
108 [LetsGameAPI instance].appId = @"10056"; 109 [LetsGameAPI instance].appId = @"10056";
109 [LetsGameAPI instance].appKey = @"b59c21a078fde074a6750e91ed19fb21"; 110 [LetsGameAPI instance].appKey = @"b59c21a078fde074a6750e91ed19fb21";
110 [[LetsGameAPI instance] logout]; 111 [[LetsGameAPI instance] logout];
111 112
112 } 113 }
113 114
114 -(void)onPayTest{ 115 -(void)onPayTest{
115 [LetsGameAPI instance].appId = @"10056";//10022 116 [LetsGameAPI instance].appId = @"10056";//10022
116 [LetsGameAPI instance].appKey = @"b59c21a078fde074a6750e91ed19fb21";//93a27b0bd99bac3e68a440b48aa421ab 117 [LetsGameAPI instance].appKey = @"b59c21a078fde074a6750e91ed19fb21";//93a27b0bd99bac3e68a440b48aa421ab
117 NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; 118 NSMutableDictionary *payInfo = [NSMutableDictionary dictionary];
118 [payInfo setValue:@"100" forKey:@"serverId"]; 119 [payInfo setValue:@"100" forKey:@"serverId"];
119 [payInfo setValue:@"10010" forKey:@"roleId"]; 120 [payInfo setValue:@"10010" forKey:@"roleId"];
120 [payInfo setValue:@"1000" forKey:@"channelId"]; 121 [payInfo setValue:@"1000" forKey:@"channelId"];
121 [payInfo setValue:@"10" forKey:@"amount"]; 122 [payInfo setValue:@"10" forKey:@"amount"];
122 [payInfo setValue:@"ios demo" forKey:@"extraInfo"]; 123 [payInfo setValue:@"ios demo" forKey:@"extraInfo"];
123 [payInfo setValue:@"test" forKey:@"product"]; 124 [payInfo setValue:@"test" forKey:@"product"];
124 [payInfo setValue:@"76c17cc68ff9f7f40bd3d096ccc5600a" forKey:@"sessionKey"]; //self.sessionKey 125 [payInfo setValue:@"76c17cc68ff9f7f40bd3d096ccc5600a" forKey:@"sessionKey"]; //self.sessionKey
125 [[LetsGameAPI instance] pay:payInfo handleCallBack:^{ 126 [[LetsGameAPI instance] pay:payInfo handleCallBack:^{
126 NSLog(@"第三方支付完成"); 127 NSLog(@"第三方支付完成");
127 }]; 128 }];
128 } 129 }
129 130
130 -(void)onIapTest{ 131 -(void)onIapTest{
131 [LetsGameAPI instance].appId = @"10056"; 132 [LetsGameAPI instance].appId = @"10056";
132 [LetsGameAPI instance].appKey = @"b59c21a078fde074a6750e91ed19fb21"; 133 [LetsGameAPI instance].appKey = @"b59c21a078fde074a6750e91ed19fb21";
133 NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; 134 NSMutableDictionary *payInfo = [NSMutableDictionary dictionary];
134 [payInfo setValue:@"5001" forKey:@"serverId"]; 135 [payInfo setValue:@"5001" forKey:@"serverId"];
135 [payInfo setValue:@"10010" forKey:@"roleId"]; 136 [payInfo setValue:@"10010" forKey:@"roleId"];
136 [payInfo setValue:@"1000" forKey:@"channelId"]; 137 [payInfo setValue:@"1000" forKey:@"channelId"];
137 [payInfo setValue:@"10" forKey:@"amount"]; 138 [payInfo setValue:@"10" forKey:@"amount"];
138 [payInfo setValue:@"ios demo" forKey:@"extraInfo"]; 139 [payInfo setValue:@"ios demo" forKey:@"extraInfo"];
139 [payInfo setValue:@"test.product.1" forKey:@"product"]; 140 [payInfo setValue:@"test.product.1" forKey:@"product"];
140 [[LetsGameAPI instance] iap:payInfo forUser:@"" succCallback:^(NSString *orderId) { 141 [[LetsGameAPI instance] iap:payInfo forUser:@"" succCallback:^(NSString *orderId) {
141 //注意测试仅仅是通知客户端成功,但是还需要向服务器请求验证是否成功,以服务端验证为准 142 //注意测试仅仅是通知客户端成功,但是还需要向服务器请求验证是否成功,以服务端验证为准
142 NSLog(@"IAP completed orderId of Gumptech:%@",orderId); 143 NSLog(@"IAP completed orderId of Gumptech:%@",orderId);
143 } failCallback:^(NSString *orderId) { 144 } failCallback:^(NSString *orderId) {
144 NSLog(@"IAP file orderId of Gumptech:%@",orderId); 145 NSLog(@"IAP file orderId of Gumptech:%@",orderId);
145 }]; 146 }];
146 } 147 }
147 148
148 149
149 - (BOOL)shouldAutorotate { 150 - (BOOL)shouldAutorotate {
150 return YES; 151 return YES;
151 } 152 }
152 153
153 -(UIInterfaceOrientationMask)supportedInterfaceOrientations{ 154 -(UIInterfaceOrientationMask)supportedInterfaceOrientations{
154 return UIInterfaceOrientationMaskAll; 155 return UIInterfaceOrientationMaskAll;
155 } 156 }
156 157
157 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 158 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
158 return YES; 159 return YES;
159 } 160 }
160 161
161 @end 162 @end
162 163
ios/GameSDKResources.bundle/images/ic_line@2x.png

11.7 KB