ios - 如何在我的应用程序中使用 Facebook 登录并在成功登录后移至下一个页面/ View Controller ?

标签 ios swift xcode

在我的 iOS 应用程序中使用 Facebook 登录后,当我按下“继续”按钮时,我想转到下一页/ View Controller ,而不是看到“注销按钮”和同一页面。我该怎么做?

我尝试在这里添加segue

   func loginButton(_ loginButton: FBSDKLoginButton!, didCompleteWith result: FBSDKLoginManagerLoginResult!, error: Error!) {
    if error != nil {
        print(error)
        return
    }
    performSegue(withIdentifier: "segueVC", sender: nil)
    print("sucessfully logged in with FB")


}

但是没有成功。多谢!

最佳答案

尝试在主线程中调用performSegue

class ViewController:UIViewController {


 func loginButton(_ loginButton: FBSDKLoginButton!, didCompleteWith result: FBSDKLoginManagerLoginResult!, error: Error!) {

   if error != nil {
     print(error)
     return
   }

   DispatchQueue.main.async {
     performSegue(withIdentifier: "segueVC", sender: nil)
   }
 }


}

关于ios - 如何在我的应用程序中使用 Facebook 登录并在成功登录后移至下一个页面/ View Controller ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49477755/

相关文章:

Xcode 4 无法识别框架 header 目录已提交 (GIT)

iOS - Xcode 9.2 中缺少 CFBundleIconName

ios - 如何从VC subview 向VC super View 发送数据

ios - UICollectionViewCell 延迟重绘自定义 UIView 子层

iphone - 导航 Controller 崩溃

objective-c - Obj-C - 导入(Swift 编译器识别?)

ios - 如何清除/删除iOS上的键盘缓存?

ios - 在 UitableView 中的 UitableView

swift - Apple Mach-O 链接器错误(静态,不是 ld)

xcode - 在 Xcode 中,有没有办法在调用 NSLog 时禁用调试器控制台中显示的时间戳?