2016-11-24 114 views
2

有沒有人遇到過這個問題?按下登錄按鈕並啓動該過程後,用戶將卡在此屏幕上,您應在其中啓用或確認應用程序的權限。但是,這裏沒有什麼可做的。Facebook登錄iOS SDK被卡在「Confirm」

Screenshot from iOS Simulator

+0

我目前有我的應用程序完全一樣的問題!我首先以爲這是我正在使用的科爾多瓦插件的錯,但看到你是原生的,我覺得Facebook是一個罪魁禍首。 – Mencls

+0

我也面臨同樣的問題,無法找到任何東西,肯定會出現錯誤@臉書這發生在現場運行的應用程序也(只有IOS),Android應用程序工作正常。 – Alok

+0

看起來問題已根據此錯誤報告修復:https://developers.facebook.com/bugs/180459832419216/?comment_id = 619998781505655 – amudi

回答

0
In appdelegate: 

import FacebookCore 

func application(_ application: UIApplication, 
        didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 
    SDKApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions) 

    return true 
} 

func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool { 
    return SDKApplicationDelegate.shared.application(application, 
                open: url, 
                sourceApplication: sourceApplication, 
                annotation: annotation) 
} 


@available(iOS 9.0, *) 
func application(_ application: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool { 
    return SDKApplicationDelegate.shared.application(application, open: url, options: options) 
} 

func applicationDidBecomeActive(_ application: UIApplication) { 
    AppEventsLogger.activate(application) 
} 


In View Controller 

import FacebookCore 
import FacebookLogin 


func facebookLogin() { 
    let loginManager = LoginManager() 
    loginManager.logIn([ .email ], viewController: self) { (loginResult) in 
     switch loginResult { 
     case .failed(let error): 
      print(error) 
     case .cancelled: 
      print("User cancelled login.") 
     case .success(let grantedPermissions, let declinedPermissions, let accessToken): 
      print("Logged in \(grantedPermissions) \(declinedPermissions) \(accessToken)") 
     } 
    } 
} 

And if you have multiple social login like facebook login and google signin 

func application(_ application: UIApplication, 
       open url: URL, sourceApplication: String?, annotation: Any) -> Bool { 

    var _: [String: AnyObject] = [UIApplicationOpenURLOptionsKey.sourceApplication.rawValue: sourceApplication as AnyObject, 
             UIApplicationOpenURLOptionsKey.annotation.rawValue: annotation as AnyObject] 

    if url.absoluteString.contains("facebook") { 
     return SDKApplicationDelegate.shared.application(application, 
                 open: url, 
                 sourceApplication: sourceApplication, 
                 annotation: annotation) 
    }else{ 
     return GIDSignIn.sharedInstance().handle(url as URL!, 
               sourceApplication: sourceApplication, 
               annotation: annotation) 
    } 
} 

上述編輯應該工作。

來源: https://github.com/facebook/facebook-sdk-swift/blob/master/Samples/Catalog/Sources/AppDelegate.swift