我已经安装了Facebook SDK,遵循了所有要求,因为我可以从用户的Facebook帐户中提取数据,但是我登录后无法执行segue.
我收到一条错误消息:
警告: Attempt to present <viewController1> on <FBSDKContainerViewController> whose view is not in the window hierarchy!
这是我的代码:
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
if (FBSDKAccessToken.currentAccessToken() == nil) {
print("not logged in")
}
else {
print("logged in")
}
let loginButton = FBSDKLoginButton()
loginButton.readPermissions = ["public_profile", "email", "user_friends"]
loginButton.center = self.view.center
loginButton.delegate = self
self.view.addSubview(loginButton)
}
func loginButton(loginButton: FBSDKLoginButton!, didCompleteWithResult result: FBSDKLoginManagerLoginResult!, error: NSError!) {
if …Run Code Online (Sandbox Code Playgroud)