iOS crash on Social Leaderboard LoadScores after upgrading to Unity5
Hello,
I have the following code that I use to setup leaderboards on my game:
public void Setup(Dictionary<string, IUserProfile> friendsHashTable)
{
ILeaderboard leaderboard leaderboard = SocialManager.GetSocialPlatform().CreateLeaderboard();
this.friendsHashTable = null == friendsHashTable? this.friendsHashTable : friendsHashTable;
if(!IsCompleted())
{
return;
}
leaderboard.SetUserFilter(GetFriendsFilterList());
leaderboard.LoadScores(OnScoresLoaded);
}
It used to work fine on 4.6.4 and it works fine on Android as well for 5.3.4f1; however when I run it on iOS it crashes with the following error message:
2016-03-29 18:34:46.506 bith[4820:60b] -[GKLeaderboard initWithPlayers:]: unrecognized selector sent to instance 0x16f63af0
2016-03-29 18:34:46.726 bith[4820:60b] Uncaught exception: NSInvalidArgumentException: -[GKLeaderboard initWithPlayers:]: unrecognized selector sent to instance 0x16f63af0
(
0 CoreFoundation 0x2f2a0ee3 <redacted> + 154
1 libobjc.A.dylib 0x39a3bce7 objc_exception_throw + 38
2 CoreFoundation 0x2f2a47f7 <redacted> + 202
3 CoreFoundation 0x2f2a30f7 <redacted> + 706
4 CoreFoundation 0x2f1f2058 _CF_forwarding_prep_0 + 24
5 bith 0x01770608 ___ZN10GameCenter13GcLeaderboard6CreateEP9MonoArray_block_invoke + 432
6 GameCenterFoundation 0x2fe5aca1 <redacted> + 12
7 libdispatch.dylib 0x39f24d53 <redacted> + 10
8 libdispatch.dylib 0x39f24d3f <redacted> + 22
9 libdispatch.dylib 0x39f276c3 _dispatch_main_queue_callback_4CF + 278
10 CoreFoundation 0x2f26b641 <redacted> + 8
11 CoreFoundation 0x2f269f0d <redacted> + 1308
12 CoreFoundation 0x2f1d4729 CFRunLoopRunSpecific + 524
13 CoreFoundation 0x2f1d450b CFRunLoopRunInMode + 106
14 GraphicsServices 0x341436d3 GSEventRunModal + 138
15 UIKit 0x31b35871 UIApplicationMain + 1136
16 bith 0x00023d94 main + 164
17 libdyld.dylib 0x39f39ab7 <redacted> + 2
)
From testing the this seems to be the call that causes the issue:
leaderboard.LoadScores(OnScoresLoaded);
Has anyone come across this before? Or does anyone know what may be causing it?
Thanks.
Small update, yesterday we found out that if we stopped using
leaderboard.SetUserFilter(GetFriendsFilterList());
It would no longer crash. It is not right because the leaderboards are failing to load, the message we are getting is that the user is not autenticated; however, we are testing for the user to be autenticated and it is, so this seems to be a conflicting message.
This is the updated code:
...
string[] friends = this.GetFriendsFilterList();
Debug.LogWarningFormat("\n\n\nFriends in leaderboard are null {0}", friends.Length);
Debug.LogWarningFormat("\n\n\nIs user autenticated? {0}", Social$$anonymous$$anager.GetSocialPlatform().localUser.authenticated);
//leaderboard.SetUserFilter(GetFriendsFilterList());
leaderboard.LoadScores(OnScoresLoaded);
...
And this is a sample of the messages we are getting:
Friends in leaderboard are null 3
UnityEngine.Logger:LogFormat(LogType, String, Object[])
UnityEngine.Debug:LogWarningFormat(String, Object[])
UpUp$$anonymous$$erboard:Setup(Dictionary`2)
Social$$anonymous$$anager:Build$$anonymous$$erboards()
Social$$anonymous$$anager:OnUserFriendsLoaded(Boolean)
(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
Is user autenticated? True
UnityEngine.Logger:LogFormat(LogType, String, Object[])
UnityEngine.Debug:LogWarningFormat(String, Object[])
UpUp$$anonymous$$erboard:Setup(Dictionary`2)
Social$$anonymous$$anager:Build$$anonymous$$erboards()
Social$$anonymous$$anager:OnUserFriendsLoaded(Boolean)
(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
2016-03-30 10:56:53.138 bith[4897:60b] Failed to load scores The requested operation could not be completed because local player has not been authenticated.
Failed to load leaderboard scores for leaderboard: <Some$$anonymous$$erboardName>
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:LogError(Object)
UpUp$$anonymous$$erboard:OnScoresLoaded(Boolean)
We are still investigating the issue, but any suggestions are very welcomed.
Hi @andreshvs! Do you have any update on the issue? Have you managed to solve this or create any workaround? We've stumped on the same problem and if you've managed to overcome it, any info would be appreciated. Thanks!
Hi @sejton. To be honest the only workaround I was able to fine was using the Prime31 plugin and adding a wrapper over it using the unity interface for social. I have not looked anymore in this issue but would love to hear if anyone finds a solution.
Your answer
Follow this Question
Related Questions
Game crashes on iPhone 11 0 Answers
Unity 5.4 crash after iOS version building and open xcode8 0 Answers
Simple Leaderboad 1 Answer
Unity crashes whenever I try to modify a prefab 1 Answer
IOS app crashes after splash screen 1 Answer