ios - 其 View 不在窗口层次结构中

标签 ios swift facebook

我收到此警告,我不明白代码中的错误在哪里

使用代码 7.2 和 iOS 9.2

错误:

warning: Attempt to present < VidcustCustomAppIos.VCTabBarController: 0x7ff838f50790 > on < FBSDKContainerViewController: 0x7ff838d8ceb0 > whose view is not in the window hierarchy!

 @IBAction func facebookLoginDidTouch(sender: AnyObject) {
    let loginManager = FBSDKLoginManager()
    loginManager.logInWithReadPermissions(["public_profile", "email"], fromViewController: self) { (result:FBSDKLoginManagerLoginResult!, error:NSError!) -> Void in
         if (result.isCancelled) {
            print("Cancelled")
        } else {
            print("Logged in")
           let token =  FBSDKAccessToken.currentAccessToken()
            VCClusterManager.sharedInstance.connectWithFacebook(token.tokenString, completion: { (isConnected, error) -> () in
                if error == nil && isConnected == true {
                    self.performSegueWithIdentifier(self.segueIdentifier, sender: nil)
                }
            })
        }
    }
}

最佳答案

这不是 Facebook 登录的情况

从嵌入在容器中的 View Controller 执行 Segue 时,您将收到此警告。解决方案是从容器的父级使用 segue,而不是从容器的 View Controller 。

关于ios - 其 View 不在窗口层次结构中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34527421/

相关文章:

ios - Facebook 上的视频分享

iOS:如果当前正在刷行,如何防止表更新?

swift - 为什么在 Swift 中点击 iAd 时我的游戏不会暂停?

java - Seam 上的 Facebook 分享功能

ios - Facebook iOS API : how to get public profile URL

php - Facebook 页面选项卡 oauth

ios - 为 UIView/Image 设置 alpha

html - 位置:iPhone iOS 中的固定页脚

ios - 在播放其他视频时录制视频

objective-c - 我想在 iOS 7 中访问 iCloud 驱动器文件,可以吗?