Search code examples
iosunity-game-enginefacebook-unity-sdk

unity 2017.1 facebook 7.10 login not working, dialogue not displaying (iOS)


Recently upgraded to unity 2017.1 and facebook sdk 7.10 and the login dialogue no longer displays on device when making the FB.LoginWithReadPermissions(..., ...) call. I do not receive a response in my callback function and the dialogue never displays. Nothing seems to happen, no logs, no errors.

This was working in Unity 5.5.3 w/ a previous version of the facebook sdk. I have noticed that if I include facebooks sample scene and I am able to login through the sample scene. This makes me believe something has changed with the implementation that is causing my project to block the dialogue from being displayed.

Any suggestions would be appreciated.

EDIT: Forgot to mention this was an iOS build.


Solution

  • I've found the problem. Unity introduced a bug: https://issuetracker.unity3d.com/issues/ios-cannot-open-url-when-launching-fblogin-through-unity-facebook-sdk-in-portrait-only-autorotate-state

    in version 5.6.2p4 that prevents all native ios dialogues from popping up if you allow the device to autorotate. I resolved the problem by removing the code:

    Screen.orientation = ScreenOrientation.AutoRotation;

    Hope this helps someone else because this was a nightmare for me to track down.

    EDIT: Wanted to also mention that the setting for auto rotate cannot be selected in the player settings for iOS either.