2015-10-28 28 views
3

我試圖更新我的應用程序以使用兼容iOS 9的Facebook SDK v3.24.1。我們還沒有升級到v4.x,並且還沒有完成,所以我需要使用v3.24.1。我按照這個Facebook的遷移指南:developers.facebook.com/docs/ios/ios9iOS - Facebook SDK v3.24.1登錄屏幕是空的,除非使用FBSessionLoginBehaviorForcingWebView

我添加了所有適當的Facebook的設置,以我的.plist文件(即CFBundleURLSchemes,FacebookAppID,FacebookDisplayName等)

我也更新了的.plist的IOS 9需求:

<key>NSAppTransportSecurity</key> 
<dict> 
    <key>NSAllowsArbitraryLoads</key> 
    <true/> 
</dict> 

我已經更新了框架文件,並修改了Facebook登錄方法現在使用:

[[FBSession activeSession] openWithBehavior:FBSessionLoginBehaviorWithFallbackToWebView fromViewController:fromViewController completionHandler:handler]; 

這個問題我有的是,如果我嘗試使用'FBSessionLoginBehaviorForcingWebView'之外的任何'行爲',我所得到的只是一個空白的白色模態屏幕(如下)。我真的需要允許應用程序在回到Web視圖之前嘗試使用iOS本機Facebook設置或Facebook應用程序進行身份驗證。

有什麼建議嗎?

enter image description here

使用 'FBSessionLoginBehaviorForcingWebView' 不給我正確的Web視圖模式:

enter image description here

回答

1

這是蘋果的SafariViewController的錯誤。

當您在[UIBarButtonItem appearance] setBackgroundImage:中使用UIImageRenderingModeAlwaysTemplate UIImage並嘗試顯示SFSafariViewController時,您只會看到空白頁。

UIImage *image = [[UIImage imageNamed:@"someimage"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; 
[[UIBarButtonItem appearance] setBackgroundImage:image forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; 

使用普通的UIImage將顯示SFSafariViewController。

+1

這是我的修復。我們有自定義導航欄和按鈕,顯然打破SFSafariViewController。 – JimmyJammed