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

标签 authentication ios9 facebook-ios-sdk

我正在尝试更新我的应用程序以使用兼容 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 应用进行身份验证。

有什么建议吗?

enter image description here

使用“FBSessionLoginBehaviorForcingWebView”确实为我提供了正确的 WebView 模式:

enter image description here

最佳答案

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

相关文章:

ios - 在 App Store 中发布之前测试 Facebook iOS 请求?

authentication - IdentityServer4 client_id 特定的登录页面

python - Flask:注销时 token 过期

ios - 如何解决 Type of expression is ambiguous without more context for an audio recorder in swift 2

ios - 应用程序后台刷新ios9 swift

ios - FBSDKAppEvents.activateApp() 无法识别的选择器发送到实例

ios - 如何从我的应用程序中删除新的返回上一个应用程序 iOS 9 按钮?

java - Spring Security 用户身份验证不起作用

android - 使用 LibGDX 的 Facebook 登录 3.0

ios - iOS 9 中的 UIAlertView 问题