我正在使用 Facebook 登录我的 iOS 应用程序,该应用程序是为 iOS 8 及更高版本开发的。 (正在使用最新的Facebook SDK)
我已遵循 Facebook 官方指南中描述的所有基本步骤。但是,当我单击登录按钮时,出现以下错误:
构建 URL 时发生未知错误(com.facebook.sdk.core 错误 3)
我已经检查过,看看我可能做错了什么,但一切似乎都按照指南进行,我已经被困在这里一天了。
FB登录委托代码:
class FBLoginDelegate: NSObject, FBSDKLoginButtonDelegate {
func loginButton(loginButton: FBSDKLoginButton!, didCompleteWithResult result: FBSDKLoginManagerLoginResult!, error: NSError!){
if(error == nil){
print("Logged In from Btn")
}else{
print("Error: \(error.localizedDescription)") //Here it gives the error
}
}
}
FB登录按钮代码:
var fbLoginBtnDelegate = FBLoginDelegate()
let fbBtnWidth = self.view.bounds.width - (self.fbContainerLeftConstraint.constant + self.fbContainerRightConstraint.constant)
let fbLoginButton = FBSDKLoginButton(frame: CGRectMake(0,0,fbBtnWidth,self.fbButtonContainer.bounds.size.height))
self.fbButtonContainer.addSubview(fbLoginButton)
fbLoginButton.readPermissions = ["public_profile", "user_friends", "email", "user_birthday"]
fbLoginButton.delegate = fbLoginBtnDelegate