在转换为swift 3语法后,应用无法通过Facebook和Firebase进行身份validation

我已经清理了我的项目以解决所有错误。 应用程序似乎启动,登录页面似乎工作,但当我尝试登录到Facebook时,会发生以下情况:

TCP_CONNECTION_EVENT_TLS_HANDSHAKE_COMPLETE in response to state ready and error (null) 2016-09-15 12:36:50.254067 2[3083:89230] [] tcp_connection_event_notify 12 event: TCP_CONNECTION_EVENT_TLS_HANDSHAKE_COMPLETE, reason: nw_connection event, should deliver: true 2016-09-15 12:36:50.254511 2[3083:89230] [] tcp_connection_get_statistics DNS: 3ms/7ms since start, TCP: 61ms/76ms since start, TLS: 99ms/172ms since start 2016-09-15 12:36:50.492341 2[3083:89140] [] tcp_connection_cancel 12 2016-09-15 12:36:50.493012 2[3083:88773] [] nw_socket_handle_socket_event Event mask: 0x4 2016-09-15 12:36:50.493506 2[3083:88773] [] nw_socket_handle_socket_event Socket received WRITE_CLOSE event 2016-09-15 12:36:50.494087 2[3083:88773] [] nw_endpoint_handler_cancel [12 graph.facebook.com:443 ready resolver (satisfied)] 2016-09-15 12:36:50.494691 2[3083:88773] [] nw_endpoint_handler_cancel [12.1 31.13.78.13:443 ready socket-flow (satisfied)] 2016-09-15 12:36:50.495482 2[3083:88773] [] __nw_socket_service_writes_block_invoke sendmsg(fd 15, 31 bytes): socket has been closed 2016-09-15 12:36:50.495878 2[3083:88773] [] nw_endpoint_flow_protocol_error [12.1 31.13.78.13:443 cancelled socket-flow (null)] Socket protocol sent error: [32] Broken pipe 2016-09-15 12:36:50.496536 2[3083:88773] [] nw_endpoint_flow_protocol_disconnected [12.1 31.13.78.13:443 cancelled socket-flow (null)] Output protocol disconnected 2016-09-15 12:36:50.496888 2[3083:88773] [] nw_resolver_cancel_on_queue 0x6000003042f0 2016-09-15 12:36:50.497285 2[3083:88773] [] -[NWConcrete_tcp_connection dealloc] 12 

当我尝试登录时,这只是输出日志文件的一小部分。

顺便说一句,我的代码设置为loginviewcontroller

 import UIKit import FBSDKLoginKit import Firebase import FirebaseAuth class FacebookLoginViewController: UIViewController, FBSDKLoginButtonDelegate{ var loginButton: FBSDKLoginButton = FBSDKLoginButton() override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. self.loginButton.center = self.view.center self.loginButton.readPermissions = ["public_profile", "email", "user_friends"] self.view!.addSubview(loginButton) self.loginButton.delegate = self FIRAuth.auth()?.addAuthStateDidChangeListener { auth, user in if let user = user { // User is signed in. self.performSegueWithIdentifier("loggedIn", sender: self) } } } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } func loginButton(loginButton: FBSDKLoginButton!, didCompleteWithResult result: FBSDKLoginManagerLoginResult!, error: NSError!) { print("user logged in") if(error != nil) { } else if(result.isCancelled){ } else{ // Exchange facebook credential for a firebase credential let credential = FIRFacebookAuthProvider.credentialWithAccessToken(FBSDKAccessToken.currentAccessToken().tokenString) // Login to firebase FIRAuth.auth()?.signInWithCredential(credential) { (user, error) in self.performSegueWithIdentifier("loggedIn", sender: self) print("user logged in to firebase") } } } func loginButtonDidLogOut(loginButton: FBSDKLoginButton!) { print("user logged out") } } 

这是didFinishLaunchingWithOptions

 func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { FIRApp.configure() // Override point for customization after application launch. let navAppearance = UINavigationBar.appearance() let tabAppearance = UITabBar.appearance() let backImage = UIImage(named: "back") navAppearance.backIndicatorImage = backImage navAppearance.backIndicatorTransitionMaskImage = backImage let lightBlackColour = UIColor(red: 50/255.0, green: 50/255.0, blue: 54/255.0, alpha: 1.0) let lightYellowColour = UIColor(red: 255/255.0, green: 250/255.0, blue: 36/255.0, alpha: 1.0) navAppearance.tintColor = lightYellowColour navAppearance.barTintColor = lightBlackColour // Set the bar tint colour navAppearance.titleTextAttributes = [NSForegroundColorAttributeName: lightYellowColour] tabAppearance.barTintColor = lightBlackColour tabAppearance.tintColor = lightYellowColour let barButtonAppearance = UIBarButtonItem.appearance() barButtonAppearance.setBackButtonTitlePositionAdjustment(UIOffsetMake(0, -60), forBarMetrics: .Default) barButtonAppearance.setBackButtonTitlePositionAdjustment(UIOffsetMake(0, -60), forBarMetrics: .Compact) UIApplication.sharedApplication().statusBarStyle = .LightContent FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions) return true } 

在我的应用程序中,Facebook和谷歌登录不在iOS 10中工作。所以我已经开启了钥匙串共享,它的工作原理。 喜欢

Scrrenshot

它可能有所帮助。 如果没有,请告诉我。

在调试方案中设置OS_ACTIVITY_MODE = disable。

编辑方案 – >运行 – >参数 – >环境变量 – > OS_ACTIVITY_MODE =禁用