Ios 正在尝试在我的应用程序中使用Facebook功能注册
我有一个自定义按钮,用户可以在Facebook上注册。但是,当我测试时,它显示我已授权该应用程序,但它仍保留在safari页面上,不会返回到我的应用程序。到目前为止,我的代码是这样的Ios 正在尝试在我的应用程序中使用Facebook功能注册,ios,facebook,swift,facebook-login,Ios,Facebook,Swift,Facebook Login,我有一个自定义按钮,用户可以在Facebook上注册。但是,当我测试时,它显示我已授权该应用程序,但它仍保留在safari页面上,不会返回到我的应用程序。到目前为止,我的代码是这样的 @IBAction func facebookButtonWasHit(sender: AnyObject) { let permissions = [ "public_profile", "email" ] FBSDKLoginManager().logInWithReadPer
@IBAction func facebookButtonWasHit(sender: AnyObject) {
let permissions = [ "public_profile", "email" ]
FBSDKLoginManager().logInWithReadPermissions(permissions, fromViewController: nil, handler: { (result, error) in
if error != nil {
self.presentViewController(UIAlertController(title: "Whoops!", message: error!.localizedDescription), animated: true, completion: nil)
}
else if result.isCancelled {
self.presentViewController(UIAlertController(title: "Whoops!", message: "We couldn't access facebook! Did you hit cancel?"), animated: true, completion: nil)
}
else {
if((FBSDKAccessToken.currentAccessToken()) == nil){
FBSDKGraphRequest(graphPath: "me", parameters:["fields":"email,name"]).startWithCompletionHandler({ (connection, result, error) in
if error != nil {
self.presentViewController(UIAlertController(title: "Whoops!", message: error!.localizedDescription), animated: true, completion: nil)
} else {
if let loginResult = result as? Dictionary<String,AnyObject> {
dispatch_async(dispatch_get_main_queue(), {
if let emailID = loginResult["email"] as? String{
self.emailTextField.text = emailID
}
self.nameTextField.text = loginResult["name"] as? String
let userID = loginResult["id"] as! String
let facebookProfileUrl = "http://graph.facebook.com/\(userID)/picture?type=large"
let url = NSURL(string:facebookProfileUrl)
self.picChanged = true
self.downloadImage(url!)
})
}
}
})
}
}
})
}
请给出我已授权应用程序的屏幕截图,听起来您缺少此文档中的第6步: