iOS - Facebook SDK v3.24.1 登录屏幕为空白,使用 FBSessionLoginBehaviorForcingWebView 时除外

iOS - Facebook SDK v3.24.1 Login Screen is Blank except when using FBSessionLoginBehaviorForcingWebView

我正在尝试更新我的应用程序以使用 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' 之外的任何 'behaviors',我得到的只是一个空白的白色模式屏幕(如下)。我确实需要允许该应用在返回到网络视图之前尝试使用 iOS 本机 Facebook 设置或 Facebook 应用进行身份验证。

有什么建议吗?

使用 'FBSessionLoginBehaviorForcingWebView' 确实为我提供了正确的网络视图模式:

这是 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。