- Home /
Social.LoadUsers causes consistent crash when building to iOS
I get a list of Game Center user IDs using LoadScores, but unfortunately these only contain user IDs ("G:" followed by a string of digits). Now, previously we have used Social.LoadUsers on a string array of these IDs to retrieve user names, but I am seeing a consistent crash every time I do anything to access LoadUsers, e.g.:
List<string> userIDs = new List<string>();
foreach ((string, int) leader in allTimeTreasureLeaders)
{
userIDs.Add(leader.Item1);
}
string[] userIDArray = userIDs.ToArray();
Social.LoadUsers(userIDArray, users =>
{
foreach (IUserProfile user in users)
{
Debug.Log(user.userName);
}
});
What is strange is I can see the print out of the names here, but then I get an EXC_BAD_ACCESS anyway. Note that I'm not doing anything with these user names as the moment--it seems to just be the call to LoadUsers that causes the crash.
A couple of other comments to elaborate: this is in a static class, and allTimeTreasureLeaders is a List<(string, int)> that is populated in this class separately by a call to LoadScores. At the moment it contains 3 entries (our team).
Does anyone see an issue with what I'm doing or had this issue before?
I am suspicious that the updates to leaderboards announced at WWDC 2020 have changed the way the Game Center API works. I am also seeing issues reporting scores to recurring leaderboards, which are new this year.
Confirmed that updating to 2019.4.10 (latest LTS) does not solve issue.
Answer by pandolfini · Oct 13, 2020 at 04:53 AM
This is a bug. It is triggered on a scene change after calling Social.LoadUsers, confirmed by another thread on Unity forums. Only resolution is an alternate method of accessing Game Center's API--Prime31 makes such a product for Game Center for $64.
Your answer
Follow this Question
Related Questions
Game Center login issue 0 Answers
Social.ReportScore not doing anything on iPhone 1 Answer
Social.LoadAchievements sends Debug.Log messages 1 Answer
Can't call GameCenter in my Unity game for iOS 0 Answers
Is it possible to send Game Center challenges to your friends using Unity's own Social API? 0 Answers