当我在其中运行应用程序时,viewDidLoad我需要检查用户之前是否登录过。
if FBSDKAccessToken.currentAccessToken() != nil {
print("1")
presentViewController(controller, animated: true, completion: nil)
} else {
print("2")
let button = FBSDKLoginButton()
button.delegate = self
button.readPermissions = ["public_profile", "user_friends"]
view.addSubview(button)
}
它总是打印"2"。为什么?