【问题标题】:in-app facebook authorization - similar to tinder [closed]应用内 facebook 授权 - 类似于 tinder [关闭]
【发布时间】:2015-11-28 19:51:39
【问题描述】:

我已按照 facebook SDK 教程将登录按钮合并到我的 ios iphone 应用程序中,它会打开一个 Web 浏览器并要求我登录。我注意到其他应用程序执行更多的“应用程序内”无缝登录到 Facebook 帐户。一个例子是 tinder,下面是 tinder 中发生的确切流程:

1:

2:

3:

4:

完成

我怎样才能实现这种行为?我希望像使用 tinder 一样进行授权,而无需切换到浏览器来获取登录令牌?

谁能告诉我怎么做?

谢谢

【问题讨论】:

    标签: ios iphone facebook


    【解决方案1】:

    您只需要集成 Facebook iOS SDK 并设置正确的登录管理器loginBehavior

    FBSDKLoginManager *mgr = [[FBSDKLoginManager alloc] init];
    mgr.loginBehavior = FBSDKLoginBehaviorSystemAccount;
    [mgr logInWithReadPermissions:@[@"user_email"] 
                          handler:^(FBSDKLoginManagerLoginResult *result, NSError *error){
                              // handle login result here
                          }];
    

    参考:https://developers.facebook.com/docs/reference/ios/current/class/FBSDKLoginManager/

    【讨论】:

    • 你好,谢谢你的建议,不幸的是它仍然重定向到另一个页面,我总是需要点击“确定”,看截图:i.imgur.com/LSjhA9r.png顺便说一句,我正在使用权限“public_profile” .
    • 对不起,你是对的!这是因为我正在从模拟器(没有安装 facebook)运行应用程序。感谢您帮助我,将您的答案标记为已接受。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-05-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多