Unity C# Social.LoadUsers causes consistent crash when building to iOS

Viewed 331

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?

EDIT: here is the stack trace.

Stack Trace

1 Answers

I believe Unity's wrapper is currently broken based on a thread on Unity's message boards where someone tracked a crash on scene changing to the same call to LoadUsers.

He, and we, resolved this issue by using Prime31's Game Center plugin. While I do not like spending $64 for one line of code, it was not worth my time to wait for Unity on this one. Unfortunately, native Unity Game Center for custom UI--assuming you want to display user names--is for all intents and purposes broken as far as I can tell.

Related