JoshLmao / Spotify4Unity

🎮🎵 Add the SpotifyAPI.NET library into Unity, enabling access to the Spotify Web API, allowing for control of Spotify and accessing the world of music
https://assetstore.unity.com/packages/tools/integration/spotify4unity-ui-tools-spotify-authorization-129028
MIT License
94 stars 8 forks source link

None of the callbacks are firing despite successful connect on Unity 2019.4 iOS with ARFoundation #32

Open yosun opened 3 years ago

yosun commented 3 years ago

Describe the bug

I am running your MobileScene in an ARFoundation project Unity 2019.4.4f1 LTS

Downloaded a fresh copy of your Unity asset and got it to run and click through the authentication on iOS. However, the app is not able to actually load data? Not even user profile?

It looks like none of the callbacks are ever being called even though it says successfully connected...

Here are some sample snippets from the xcode log:

Spotify4Unity - Successfully connected to the Spotify Web API
Scopes: PlaylistModifyPublic, PlaylistModifyPrivate, PlaylistReadPrivate, Streaming, UserReadPrivate, UserReadEmail, UserLibraryRead, UserLibraryModify, UserFollowModify, UserFollowRead, UserTopRead, PlaylistReadCollaborative, UserReadRecentlyPlayed, UserReadPlaybackState, UserModifyPlaybackState, UserReadCurrentlyPlaying
Spotify4Unity.SpotifyServiceBase:Configure(Token, AuthorizationCodeAuth)
Spotify4Unity.MobileSpotifyService:OnRecievedAuth(String)

(Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)

NotSupportedException: System.Reflection.Emit.DynamicMethod::.ctor
  at System.Reflection.Emit.DynamicMethod..ctor (System.String name, System.Type returnType, System.Type[] parameterTypes, System.Type owner, System.Boolean skipVisibility) [0x00000] in <00000000000000000000000000000000>:0 
  at Newtonsoft.Json.Utilities.DynamicReflectionDelegateFactory.CreateDynamicMethod (System.String name, System.Type returnType, System.Type[] parameterTypes, System.Type owner) [0x00000] in <00000000000000000000000000000000>:0 
  at
Rethrow as AggregateException: One or more errors occurred.
  at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00000] in <00000000000000000000000000000000>:0 
  at System.Threading.Tasks.Task`1[TResult].GetResultCore (System.Boolean waitCompletionNotification) [0x00000] in <00000000000000000000000000000000>:0 
  at Spotify4Unity.SpotifyServiceBase.InitializeService () [0x00000] in <00000000000000000000000000000000>:0 
  at Spotify4Unity.SpotifyServiceBase.Configure (SpotifyAPI.Web.Models.Token token, SpotifyAPI.Web.Auth.AuthorizationCodeAuth auth) [0x00000] in <00000000000000000000000000000000>:0 
  at Spotify4Unity.MobileSpotifyService.OnRecievedAuth (System.String authArgs) [0x00000] in <00000000000000000000000000000000>:0 

(Filename: currently not available on il2cpp Line: -1)

Spotify4Unity - Saved auth token to reuse
Spotify4Unity.MobileSpotifyService:GotAuth(Token, AuthorizationCodeAuth)
EventDelegate`1:Invoke(T)
EventDelegate:Invoke(GameEventBase)
EventManager:TriggerEvent(GameEventBase)
EventManager:Update()

(Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)

To Reproduce: If you can, list some of the steps you are taking

Expected behavior

User info and other info should show up?

Platform:

Unity Version:

JoshLmao commented 3 years ago

Unfortunately, it's always been a little ropey when it comes to Android/iOS support, especially since Unity has made a lot of changes since Spotify4Unity was first made. I personally haven't tested it on the newer versions so I can't say it supports them.

yosun commented 3 years ago

Do you have any insights on what might be happening here?

Your docs mention it works with Unity 2019.3.0f2+ ... so I actually upgraded my project to .4 LTS

JoshLmao commented 3 years ago

I do have a little idea because others have had problems with IL2CPP. iirc, it's because of Newtonsoft.Json not being compatible, this is the latest issue which is similar (#26).

Try using JSON.NET for Unity. Read step 7 of the iOS setup steps and see if that fixed your problem