我正在尝试更新我的应用程序以使用兼容 iOS 9 的 Facebook SDK v3.24.1。我们还没有升级到 v4.x,现在还不能升级,所以我需要使用 v3.24.1。我遵循了这个 Facebook 迁移指南:developers.facebook.com/docs/ios/ios9
我已将所有适当的 Facebook 设置添加到我的 .plist 文件(即 CFBundleURLSchemes、FacebookAppID、FacebookDisplayName 等)。
我还针对 iOS 9 要求更新了 .plist:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
我已经更新了框架文件并修改了 Facebook 登录方法,现在可以使用:
[[FBSession activeSession] openWithBehavior:FBSessionLoginBehaviorWithFallbackToWebView fromViewController:fromViewController completionHandler:handler];
我遇到的问题是,如果我尝试使用“FBSessionLoginBehaviorForcingWebView”以外的任何“行为”,我得到的只是一个空白的白色模式屏幕(如下)。我确实需要允许该应用在返回到 Web View 之前尝试使用 iOS native Facebook 设置或 Facebook 应用进行身份验证。
有什么建议吗?
使用“FBSessionLoginBehaviorForcingWebView”确实为我提供了正确的 WebView 模式:
最佳答案
这是 Apple 的 SafariViewController 中的错误。
当您在 [UIBarButtonItem appearance] setBackgroundImage:
中使用 UIImageRenderingModeAlwaysTemplate UIImage 并尝试显示 SFSafariViewController 时,您只会得到一个空白页面。
UIImage *image = [[UIImage imageNamed:@"someimage"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
[[UIBarButtonItem appearance] setBackgroundImage:image forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
使用普通的 UIImage 将显示 SFSafariViewController。
关于authentication - iOS - Facebook SDK v3.24.1 登录屏幕为空白,使用 FBSessionLoginBehaviorForcingWebView 时除外,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33401839/