Facebook SDK接入备注

1、在IOS9系统,默认登录方式改为SafariViewController,取代Safari或Facebook app

https://developers.facebook.com/blog/post/2015/08/17/SDK-for-iOS9/

代码:


FBSDKLoginButton *loginButton = [[FBSDKLoginButton alloc] init];
loginButton.center = self.view.center;
loginButton.loginBehavior = 0; // native  //这个参数修改不起作用
[self.view addSubview:loginButton];

///2017-3-1更新

Facebook API接口自动登录

FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
[login logInWithPublishPermissions:@[@"publish_actions"] handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {

}];
参考链接: https://developers.facebook.com/docs/reference/ios/current/class/FBSDKLoginManager/


其他参考文章:手游接入Facebook的那些坑
///2017-3-9更新

图片分享

    FBSDKSharePhoto *photo = [[FBSDKSharePhoto alloc] init];
    photo.image = image;
    photo.userGenerated = YES;
    FBSDKSharePhotoContent *content = [[FBSDKSharePhotoContent alloc] init];
    content.photos = @[photo];
    FBSDKShareDialog *dialog = [[FBSDKShareDialog alloc] init];
    dialog.shareContent = content;
    dialog.delegate = self;
    dialog.mode = FBSDKShareDialogModeNative;
    self.shareDialog = dialog;
    [shareDialog show];

图片分享会出现facebook app内卡死的问题。此为facebook app的bug( https://developers.facebook.com/bugs/1841143559475473/)

如下图

Facebook SDK接入备注_第1张图片

解决办法是将FBSDKShareDialogModeNative改为FBSDKShareDialogModeBrowser


待续。。。

你可能感兴趣的:(IOS9,facebook,sdk,IOS9)