Hi I have just upgraded my app to iOS 9 and using Facebook's latest SDK (version 4.6) for facebook login.
I am using custom login button hence using the LoginManager class for the same. With the previous version it was working fine but now my app gets crashed whenever I press the login button saying "unrecognized selector sent to instance"
Below is the code I am using in my GameScene class to login.
var fbLogin = FBSDKLoginManager()
func onClickFBLogin(){
let vc = self.view?.window?.rootViewController
fbLogin.logInWithReadPermissions(["public_profile"] as [AnyObject], fromViewController: vc, handler: {(result:FBSDKLoginManagerLoginResult!, error:NSError!) -> Void in
if(error != nil){
print("Facebook login error \(error)")
} else if(result.isCancelled){
print("Facebook login cancelled")
} else{
print("facebook login successful")
if(self.isSaveMeButtonPressed){
print("facebook login successful")
}
}
})
}
The app is crashing with below log on Xcode.
[FBSDKLoginManager logInWithReadPermissions:fromViewController:handler:]: unrecognized selector sent to instance 0x7f82e51251e0
Anyone facing the same issue? Or someone who can help me sort this issue?
Thanks in advance.
There was an issue in updating the Facebook SDK. It seems like Facebook has changed the way it used to install the SDK in Documents folder by giving a package file but now it gives an zip file which is not installable. Hence I just replaced the existing file in my ~\Documents\FacebookSDK folder. After that it looks like Xcode took some part of update code and some still remained same.
I removed all the frameworks from my project and re-added the usual way we add a framework in Xcode. It is working fine now.
Facebook should update its documentation on how to update to newer SDK.