我已經安裝了Facebook的SDK,跟着所有的需求,它的作品,因爲我可以從用戶的Facebook帳戶中提取數據,不過,我可以不執行一次記錄在SEGUE。登錄與FBSDK,不能執行賽格瑞
我得到一個錯誤信息:
警告: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 ((error) != nil)
{
}
else if result.isCancelled {
}
else {
if result.grantedPermissions.contains("email")
{
// Do work
returnUserData()
addViewHierarchy()
// self.performSegueWithIdentifier("signUpFollowPage", sender: self)
}
}
}
任何人都可以提供幫助嗎? 謝謝
發佈顯示用FB登錄的代碼。 – Rumin
我已添加相應的代碼。謝謝 – jim
同樣的問題,沒有「美麗」的解決方案。對此有何建議? –