Commit d392082b97e8ad4ace7f1f60de68dcb20e736fcf
1 parent
41f36ed90c
Exists in
master
增加支付
Showing 1 changed file with 13 additions and 14 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年02月13日 | 6 | 2015年02月13日 |
7 | 7 | ||
8 | 8 | ||
9 | 9 | ||
10 | ## 1、添加动态库 | 10 | ## 1、添加动态库 |
11 | 在工程里添加FacebookSDK.framework、MobileCoreServices.framework、SystemConfiguration.framework、libz.dylib、CFNetwork.framework、libletsgame.a | 11 | 在工程里添加MobileCoreServices.framework、SystemConfiguration.framework、libz.dylib、CFNetwork.framework、libletsgame.a |
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资源文件,里面包含图片及相关语言包 | 19 | 在工程里添加letsgame.bundle资源文件,里面包含图片及相关语言包 |
20 | 20 | ||
21 | 21 | ||
22 | ## 4、设置FacebookAppID和FacebookDisplayName | 22 | ## 4、在工程里添加SDK登录代码 |
23 | 在工程的info.plist里设置FacebookAppID和FacebookDisplayName | ||
24 | |||
25 | |||
26 | ## 5、在工程里添加SDK登录代码 | ||
27 | 23 | ||
28 | [LetsGameAPI instance].appId = @"100"; // 设置appId | 24 | [LetsGameAPI instance].appId = @"100"; // 设置appId |
29 | [LetsGameAPI instance].appKey = @"100"; // 设置appKey | 25 | [LetsGameAPI instance].appKey = @"100"; // 设置appKey |
30 | 26 | ||
31 | [[LetsGameAPI instance] showLoginView]; // 弹出登录页面 | 27 | [[LetsGameAPI instance] showLoginView]; // 弹出登录页面 |
32 | 28 | ||
33 | // 登录成功回调 | 29 | // 登录成功回调 |
34 | [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) { | 30 | [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) { |
35 | NSLog(@"%@", [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %d", userId, sessionKey, type]); | 31 | NSLog(@"%@", [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %d", userId, sessionKey, type]); |
36 | }; | 32 | }; |
37 | 33 | ||
38 | // 登录失败回调 | 34 | // 登录失败回调 |
39 | [LetsGameAPI instance].dismissBlock = ^() { | 35 | [LetsGameAPI instance].dismissBlock = ^() { |
40 | NSLog(@"dismiss without login"); | 36 | NSLog(@"dismiss without login"); |
41 | }; | 37 | }; |
42 | 38 | ||
43 | 39 | ||
44 | ## 6、在xxAppDelegate.h里添加代码 | ||
45 | |||
46 | - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { | ||
47 | // attempt to extract a token from the url | ||
48 | return [[LetsGameAPI instance] handleOpenURL:url sourceApplication:sourceApplication]; | ||
49 | } | ||
50 | |||
51 | 这样facebook跳转到web或facebook app 后, 登录返回时,才能够把登录信息带回来 |