Game Kit exception when trying to fetch leaderboards

I'm using Unity 2020.3.33 and an external asset too update and fetch leaderboards, when I replaced the code to use the unity one I see that crashes when fetching leaderboards.

Authentication works fine but this happens when I try to fetch my leaderboards:

Code:

var leaderboards = await GKLeaderboard.LoadLeaderboards(GameCenter.LeaderBoards.Age.ToString());

Stack:

 Default constructor not found for type Apple.Core.Runtime.NSMutableArrayString  StackTrace: at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic) [0x00000] in <00000000000000000000000000000000>:0  at System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00000] in <00000000000000000000000000000000>:0  at System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00000] in <00000000000000000000000000000000>:0  at System.Activator.CreateInstance[T] () [0x00000] in <00000000000000000000000000000000>:0  at Apple.Core.Runtime.ReflectionUtility.CreateInstanceOrDefault[T] (System.IntPtr pointer) [0x00000] in <00000000000000000000000000000000>:0 at Apple.Core.Runtime.NSMutableArrayFactory.Init[TBase,TElement] () [0x00000] in <00000000000000000000000000000000>:0  at Apple.GameKit.Leaderboards.GKLeaderboard.LoadLeaderboards (System.String[] identifiers) [0x00000] in <00000000000000000000000000000000>:0  at UIGovHighscore+d__34.MoveNext () [0x00000] in <00000000000000000000000000000000>:0  at System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0  at UIGovHighscore.ReadResidentRankV2New () [0x00000] in <00000000000000000000000000000000>:0 

  • I had the same issue. It was fixed by adding perserve markup to our root link.xml

      <assembly fullname="Apple.Core" ignoreIfMissing="1" preserve="all"/>  

Add a Comment