0
votes

I've had Facebook integrated in my Unity app, and I've been using it on my iPhone 5 with iOS 7 with no problem. But the problem comes when I try it on my friend's iPhone 6 running iOS 8. When I make a call to FB.Login() it switches to the Facebook app, as it normally should, but when it comes back to my app, Facebook opens the Webview for the Facebook login page with the error "You must log in to continue."

The app registers that Facebook.IsLoggedIn is true, and the app continues as if it's logged in, but the Webview is still there and I have to close it to get back to my app.

The only real clue I have about what could be wrong is that the LoginCallback is being called twice in iOS 8 but not in iOS 7.

Any relevant code is below, but it seems like the issue is coming from within the Facebook SDK itself.

public static readonly string FB_SCOPE = "email,public_profile,user_friends";

FB.Login(FB_SCOPE,FBLoginResult);

void FBLoginResult(FBResult result) {
    Debug.Log (result.Text);
}

Anyone have any idea, or experience anything similar?

2

2 Answers

1
votes

I had the exact same problem. Turns out the FB.Login code was fired twice.

I suggest you write a log near the FB.Login and make sure you don't see it twice.

0
votes

It seems that this is due to a bug in Unity3D specific to iOS 8. See here for details : http://fogbugz.unity3d.com/default.asp?692236_po26b9sb1uqlag7p

Here is a workaround to fix the problem in NGUI. Go to UICamera.cs and add the following line of code in the function public void ProcessTouches ()

MouseOrTouch touch = null;
if (input.phase == TouchPhase.Ended && !mTouches.TryGetValue(currentTouchID, out touch)) 
   return;

just after this :

for (int i = 0; i < Input.touchCount; ++i)
    {
        Touch input = Input.GetTouch(i);
        currentTouchID = allowMultiTouch ? input.fingerId : 1;