Commit d6a208e3c4c4a43cd66a1c190653070df307644f

Authored by 赵康
1 parent b440cf5816
Exists in master

增加ios接入文档

Showing 1 changed file with 51 additions and 0 deletions Side-by-side Diff

... ... @@ -0,0 +1,51 @@
  1 +# Gump IOS SDK使用文档
  2 +
  3 +
  4 +接入手册
  5 +V
  6 +2015年02月13日
  7 +
  8 +
  9 +
  10 +## 1、添加动态库
  11 +在工程里添加FacebookSDK.framework、MobileCoreServices.framework、SystemConfiguration.framework、libz.dylib、CFNetwork.framework、libletsgame.a
  12 +
  13 +
  14 +## 2、设置头文件搜索路径
  15 +头文件只有LetsGameAPI.h和LSGAccount.h两个文件,引入头文件,并设置搜索路径。
  16 +
  17 +
  18 +## 3、添加资源文件
  19 +在工程里添加letsgame.bundle资源文件,里面包含图片及相关语言包
  20 +
  21 +
  22 +## 4、设置FacebookAppID和FacebookDisplayName
  23 +在工程的info.plist里设置FacebookAppID和FacebookDisplayName
  24 +
  25 +
  26 +## 5、在工程里添加SDK登录代码
  27 +
  28 + [LetsGameAPI instance].appId = @"100"; // 设置appId
  29 + [LetsGameAPI instance].appKey = @"100"; // 设置appKey
  30 +
  31 + [[LetsGameAPI instance] showLoginView]; // 弹出登录页面
  32 +
  33 + // 登录成功回调
  34 + [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) {
  35 + NSLog(@"%@", [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %d", userId, sessionKey, type]);
  36 + };
  37 +
  38 + // 登录失败回调
  39 + [LetsGameAPI instance].dismissBlock = ^() {
  40 + NSLog(@"dismiss without login");
  41 + };
  42 +
  43 +
  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 后, 登录返回时,才能够把登录信息带回来
0 52 \ No newline at end of file