- Home /
Facebook LoginWithReadPermissions crashes on iOS9
I've been trying to solve this for 2 days with no luck, thought I'd just ask.
I'm using the Facebook 7.2.0 (also crashed with 7.1.0) sdk for unity. It works on most iPhone 4 and 5s with iOS 8 and below. But on two iPhone 6 with iOS9, it instantly crashes the app when I try to log in.
I've cleaned out the Facebook plugin and reinstalled the package. Here's the code I run.
string[] scope = new string[]{"public_profilie","email", "user_friends"};
FB.LogInWithReadPermissions(scope, OnFBLogin);
void OnFBLogin (IResult result)
{
if(FB.IsLoggedIn)
{
//do stuff
}
}
Works in the editor, works on Android, works on most iPhones. But on iOS9, it crashes without even bringing up the facebook login dialog.
Any help would be appreciated.
This page : https://developers.facebook.com/docs/ios/ios9 mentions that I should use 7.0.3-ios9-preview . Is this still valid or does 7.2.0 contains the necessary changes?
Hi, it took me all weekend but I was able to get it to work. I'll post an answer and close out the question.
Answer by psykojello2 · Oct 20, 2015 at 12:25 AM
It took me a while to figure this out as I hit a lot of false-negatives along the way.
Long story short, when I updated the Facebook SDK, I forgot to delete the info.plist file. As a result, I ended up with an info.plist and info 1.plist file which contained the necessary ios9 related changes.
Solution : when upgrading the SDK, delete all the old Facebook files in the SDK documentation AND Assets\Plugins\iOS\info.plist
On a side note, I still run into a bug with the callback for FB.Init() where it takes a few frames for FB.IsLoggedIn to be set to true. Details here: https://developers.facebook.com/bugs/1703008003264968 I work around it by polling for FB.IsLoggedIn
Also, on the code you shared, you should use ILoginResult ins$$anonymous$$d of IResult for your callback. See: docs