question

studio avatar image
studio asked

Error when get results back

Hi All ,

I got a funny issue, I move all my backend code into the DLL and all has been working great, but today I can no longer get the success response back from the server. It works fine in the editor, and on my android, i get the error msgs but not success msgs.

I have upgraded to the current playfab sdk

here is the request

var requestAndroid = new LoginWithAndroidDeviceIDRequest { AndroidDeviceId = SystemInfo.deviceUniqueIdentifier, AndroidDevice = SystemInfo.deviceModel, OS = SystemInfo.operatingSystem, CreateAccount = true };

Here is the trace log from unity

AndroidPlayer(ADB@127.0.0.1:34999) NullReferenceException: Object reference not set to an instance of an object at PlayFab.Json.PocoJsonSerializerStrategy.DeserializeObject (System.Object value, System.Type type) [0x00000] in <filename unknown>:0 at PlayFab.Json.SimpleJsonInstance+PlayFabSimpleJsonCuztomization.DeserializeObject (System.Object value, System.Type type) [0x00000] in <filename unknown>:0 at PlayFab.Json.PlayFabSimpleJson.DeserializeObject (System.String json, System.Type type, IJsonSerializerStrategy jsonSerializerStrategy) [0x00000] in <filename unknown>:0 at PlayFab.Json.PlayFabSimpleJson.DeserializeObject[HttpResponseObject] (System.String json, IJsonSerializerStrategy jsonSerializerStrategy) [0x00000] in <filename unknown>:0 at PlayFab.Json.SimpleJsonInstance.DeserializeObject[HttpResponseObject] (System.String json) [0x00000] in <filename unknown>:0 at PlayFab.Json.JsonWrapper.DeserializeObject[HttpResponseObject] (System.String json) [0x00000] in <filename unknown>:0 at PlayFab.Internal.PlayFabWww+<>c__DisplayClass12_0.<MakeApiCall>b__0 (System.String response) [0x00000] in <filename unknown>:0 UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object) UnityEngine.DebugLogHandler:LogException(Exception, Object) UnityEngine.Logger:LogException(Exception, Object) UnityEngine.Debug:LogException(Exception) PlayFab.Internal.<>c__DisplayClass12_0:<MakeApiCall>b__0(String) PlayFab.Internal.<Post>d__13:MoveNext() UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr) (at /Users/builduser/buildslave/unity/build/Runtime/Export/Coroutines.cs:17) (Filename: Line: -1)
unity3dandroid
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

studio avatar image studio commented ·

So i added some debug to the code , to see if I can see the error

here is the response string I get before the error

AndroidPlayer(ADB@127.0.0.1:34999)

{"code":200,"status":"OK","data":{"SessionTicket":"55848E2905116D24---E5C-8D546FA1A72B58C-EzUkY7wkADC+j9J0L+CO0GvexRL4oH8H8kGtKDQUIM0=","PlayFabId":"55848E2905116D24","NewlyCreated":false,"SettingsForUser":{"NeedsAttribution":false,"GatherDeviceInfo":false},"LastLoginTime":"2017-12-19T15:51:00.189Z"}}

any one got any ideas

0 Likes 0 ·

1 Answer

·
studio avatar image
studio answered

So I got it working by changing the code to

HttpResponseObject httpResult = new HttpResponseObject();
httpResult = JsonWrapper.DeserializeObject<HttpResponseObject>(response);

8 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image brendan commented ·

You do need to deserialize the body of the response from the service, but our SDK normally takes care of that for you. Can you provide the code snippet showing how you were making the call and processing the response before you added this deserialize call?

0 Likes 0 ·
studio avatar image studio brendan commented ·

Hi Brendan ,

Here is the code that using

 var request = new LoginWithCustomIDRequest { CustomId = SystemInfo.deviceUniqueIdentifier, CreateAccount = true };


                    PlayFabClientAPI.LoginWithCustomID(request, (result) =>
                    {
                        CompleteUserLogon(result);
                    }, (error) =>
                     {
                         if (FailedLogon != null) FailedLogon((int)error.Error);
                         BAASErrorHandler(error);
                     });

Let me know if you need anything more

0 Likes 0 ·
brendan avatar image brendan studio commented ·

So are you saying that at that stage - CompleteUserLogon, you were not able to use the result as shown in the samples? What would result.PlayFabId or result.SessionTicket return? If you weren't able to use those, what SDK and what version of it are you using?

0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.