Facebook SDK Login crashes on iOS 10
Hi,
I am currently working on implementing facebook login, and I am using Unity 5.5.0f3 and Facebook SDK 7.9.0.
I can login to facebook and retrieve an AccessToken on Android without any problems. But when I am trying to login to facebook on iOS10 the application usually crashes whenever I confirm the login on the facebook site.
I managed to get it working on 1 iOS10 device, when the user could choose to login manually using his email and password, and now he can pretty much use the login without his application crashes.
In the log I get the output:
'fb_mobile_login_native_app_switch_dialog_result'. Must be between 1 and 40 characters, and must be contain only alphanumerics, _, - or spaces, starting with alphanumeric or _.```
It seems to me, that the Facebook SDK needs to be updated according to the new changes in iOS10. Does anyone have a solution to this problem? I've checked various posts on similar problems, but without any luck for a solution.
Related questions and discussions:
We are seeing the same thing and I'm losing my $$anonymous$$d I'm submitting a bug report to Unity and Facebook
Answer by benzsuankularb · Dec 10, 2016 at 02:06 PM
I thought someone must got this before today. After running around Google. Here is a solution for me
This worked for me! Thanks a ton- Now on to all the other iOS headaches :(
Answer by scottstephan · Dec 10, 2016 at 04:21 AM
I'm not alone! Same here, but on iOS 9 + 10. Been trying to debug it for days.
Basically, a user clicks my MP button. In the background, it uses the PrompForLogin function. It goes to the Facebook website, asks to give the App approval and then if the user clicks "Okay", it loads for about a second and then hard crashes.
According to the XCode debugger and my debug statements, it looks like it never makes it back to the app as the step immediately after granting FB authorization never runs.
I have to leads: One is a log error I've been seeing: "-canOpenURL: failed for URL: "fbauth2:/" - error: "(null)" , but, according to FB, this can be ignored if your Info.plist is properly configured (WHich it should be by the FB plugin)
The other is the XCode debugger keeps giving me a nil error. I thought it was unrelated until I saw this post on StackOverflow: http://stackoverflow.com/questions/40424887/cant-login-using-facebook-login-on-ios-10
It seems like maybe the returned token has a nil value and needs to be polled for a few frames? Dunno. Let us know what you find out!
Yes, I think it might be related to the link you also shared, where the accepted answer is:
It turns out that the access token can be nil immediately after. You have to wait for a notification before it can be used. I think this is a new requirement.
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(checkLogIn) name: FBSD$$anonymous$$AccessTokenDidChangeNotification object:nil];
Since this is a pretty critical bug for apps using FacebookSD$$anonymous$$, I hope we can expect an update for the FacebookSD$$anonymous$$ soon.
Your answer
Follow this Question
Related Questions
Unity Facebook SDK Login in using FB app rather than Safari browser 1 Answer
MarshalDirectiveException: Cannot marshal type 'System.Collections.Generic.IEnumerable`1' 4 Answers
iOS game crashes before launch because of too many image assets? 1 Answer
my ios app often crash on lauch,without unity logo show 0 Answers
Unity and Vuforia app crashes on iOS after reloading scene with ARCamera 3 Answers