ParseFacebookUtils.LogInAsync gives an error only for WebPlayer

I use the Parse Unity SDK with the Facebook Unity SDK in my game so that users can log in with their Facebook account.

It works well on mobile phones (Android and iOS) and in the editor.

On Facebook Canvas (WebPlayer), on my machine (Mac Mini), with my main session (admin), with every browser (Chrome, Safari, Firefox), I get an error when calling this code:

Debug.Log("ABOUT TO LOGIN");
ParseFacebookUtils.LogInAsync(  FB.UserId,FB.AccessToken, 
                                      FB.AccessTokenExpiresAt).ContinueWith(x => 
{ 
    Debug.Log("IN TASK");
    if(x.IsFaulted || x.IsCanceled)
    {
        Debug.LogError("[FacebookManager] Error LogInAsync");
        Debug.Log(x.Exception);
    }
    else
    {
         // Connection successful
         // ...
    }
} 

// CODE CONTINUES...

The output is as follows:

ABOUT TO LOGIN

TrySetSetString can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.

IN TASK

[FacebookManager] Error LogInAsync

System.AggregateException: Exception of type 'System.AggregateException' was thrown.
---------
System.ArgumentException: TrySetSetString can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
  at (wrapper managed-to-native) UnityEngine.PlayerPrefs:TrySetSetString (string,string)
  at UnityEngine.PlayerPrefs.SetString(System.String key, System.String value)[0x00000] in /Applications/buildAgent/work/___SOME_ID____/artifacts/WebPlayerGenerated/PlayerPrefsBinding.cs:62
  at Parse.PlatformHooks+SettingWrapper.Save()[0x00000] in <filename unknown>:0
  at Parse.PlatformHooks+SettingWrapper.set_Item (System.String key, System.Object value) [0x00000] in <filename_unknown>:0
  at Parse.ParseUser.SaveCurrentUser(Parse.ParseUser user) [0x00000] in <filename unkwnown>:0
  at Parse.ParseUser.<SignUpAsync>b__0 (Sustem.Threading.Tasks.Task _) [0x00000] in <filename unknown>:0
  at Parse.Internal.InternalExtensions+<>c__DisplayClassa.<OnSuccess>b__9 (System.Threading.Tasks.Task t) [0x00000] in <filename unknown>:0
  at Parse.Internal.InternalExtensions+<>c__DisplayClass7`1[System.Object].<OnSuccess>b__6 (System.Threading.Tasks.Task t) [0x00000] in <filename unknown>:0
  at System.Threading.Tasks.Task+<>c__DisplayClass3`1+<>c__DisplayClass5[System.Threading.Tasks.Task`1[System.Object]].<ContinueWith>b__2 () [0x00000] in <filename unknown>:0

This error does not appear in other sessions on my machine, and it also does not appear on the machines of my comrades.

Here is what I have tried so far (not necessarily in that order):

  • Cleared Browser Caches
  • Tried in private navigation mode
  • 3d.com/webplayer/setup
  • 3d.com/webplayer/setup
  • Unity Web Player ( Chrome)
  • Unity Web Player ( Firefox)
  • WebPlayerPrefs .
  • PlayerPrefs rw
  • Unity Web Player, Unity Web Player Mac, ,
  • PlayerPrefs.DeleteAll() ` LogInAsync

, , ( Game Logo + ). - , union3d.com/webplayer/setup.

, - , , .

, ?

+4
2
+3

- , , TrySetSetString , . , - .

ParseObject userInfo = ParseObject ( "UserInfo" );

, , . , .

+1

All Articles