Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Native Crash with GameCenter::ExecuteGameCenterCallbacks()

Discussion in 'iOS and tvOS' started by phuongnh, Jan 9, 2020.

  1. phuongnh

    phuongnh

    Joined:
    Sep 23, 2019
    Posts:
    22
    Hello,
    We have a lot of crashed related to Unity GameCenter.
    Here is the crash log:

    Code (CSharp):
    1. Crashed: com.apple.main-thread
    2. 0  myapp                         0x101515bf0 ___get_time_nanoseconds_block_invoke.cold.1 + 4672376
    3. 1  myapp                         0x1011749e0 ___get_time_nanoseconds_block_invoke.cold.1 + 866664
    4. 2  myapp                         0x101177204 ___get_time_nanoseconds_block_invoke.cold.1 + 876940
    5. 3  myapp                         0x1007b4168 RuntimeInvoker_FalseVoid_t22962CB4C05B1D89B55A6E1139F0E87A90987017_RuntimeObject_SByte_t9070AEA2966184235653CB9B4D33B149CDA831DF(void (*)(), MethodInfo const*, void*, void**) + 23264 (Il2CppInvokerTable.cpp:23264)
    6. 4  myapp                         0x1010ed518 il2cpp::vm::Runtime::Invoke(MethodInfo const*, void*, void**, Il2CppException**) + 539 (Runtime.cpp:539)
    7. 5  myapp                         0x100dd3784 scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool) + 246 (ScriptingApi_Il2Cpp.cpp:246)
    8. 6  myapp                         0x100ddb52c ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool) + 347 (ScriptingInvocation.cpp:347)
    9. 7  myapp                         0x100f8695c InvokeGameCenterCallback(char const*, ScriptingArguments const&) + 1368 (GameCenter.mm:1368)
    10. 8  myapp                         0x100f86a10 GameCenter::ExecuteGameCenterCallbacks() + 1456 (GameCenter.mm:1456)
    11. 9  myapp                         0x100d4c8cc ExecutePlayerLoop(NativePlayerLoopSystem*) + 347 (PlayerLoop.cpp:347)
    12. 10 myapp                         0x100d4c900 ExecutePlayerLoop(NativePlayerLoopSystem*) + 365 (PlayerLoop.cpp:365)
    13. 11 myapp                         0x100d4cad8 PlayerLoop() + 45 (RecursionLimit.h:45)
    14. 12 myapp                         0x100f07ea0 UnityPlayerLoopImpl(bool) + 271 (LibEntryPoint.mm:271)
    15. 13 myapp                         0x100735104 UnityRepaint + 280 (UnityAppController+Rendering.mm:280)
    16. 14 myapp                         0x100734fe0 -[UnityAppController(Rendering) repaintDisplayLink] + 72 (UnityAppController+Rendering.mm:72)
    17. 15 QuartzCore                     0x1accf788c CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 632
    18. 16 IOKit                          0x1a7313934 IODispatchCalloutFromCFMessage + 488
    19. 17 CoreFoundation                 0x1a631f8ac __CFMachPortPerform + 172
    20. 18 CoreFoundation                 0x1a634907c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56
    21. 19 CoreFoundation                 0x1a63487a8 __CFRunLoopDoSource1 + 444
    22. 20 CoreFoundation                 0x1a634367c __CFRunLoopRun + 2168
    23. 21 CoreFoundation                 0x1a6342adc CFRunLoopRunSpecific + 464
    24. 22 GraphicsServices               0x1b02c8328 GSEventRunModal + 104
    25. 23 UIKitCore                      0x1aa43dae0 UIApplicationMain + 1936
    26. 24 myapp                         0x10072cbb0 main + 41 (main.mm:41)
    27. 25 libdyld.dylib                  0x1a61cc360 start + 4
    I have 2 functions using Unity GameCenter:
    Code (CSharp):
    1. IEnumerator SocialAuthenticate()
    2.     {
    3.         bool isAuthenticating = true;
    4.         Social.localUser.Authenticate((success) =>
    5.         {
    6.             isAuthenticating = false;
    7.         });
    8.  
    9.         while (isAuthenticating)
    10.             yield return null;
    11.  
    12.         // do something
    13.     }
    Code (CSharp):
    1. IEnumerator LoadLeaderboardScores(string userId, System.Action<bool> cb)
    2.     {
    3.         bool loading = true;
    4.         bool ok = false;
    5.         var leaderboard = Social.CreateLeaderboard();
    6.         leaderboard.id = LEADERBOARD_ID;
    7.         leaderboard.timeScope = TimeScope.AllTime;
    8.         leaderboard.SetUserFilter(new string[] { userId });
    9.         leaderboard.LoadScores((success) =>
    10.         {
    11.             loading = false;
    12.             ok = success;
    13.         });
    14.  
    15.         while (loading)
    16.             yield return null;
    17.  
    18.         cb(ok);
    19.     }
    Note: I'm trying to avoid running my callback inside GameCenter's callback.
    I'm using Unity 2018.4.12f1, could you please help?
    Thank you!
     
  2. phuongnh

    phuongnh

    Joined:
    Sep 23, 2019
    Posts:
    22
    More crashes to come:

    Code (CSharp):
    1. Crashed: com.apple.main-thread
    2. 0  myapp                         0x101152cf0 plcrash::async::dwarf_cfa_state_iterator<unsigned long long, long long>::next(unsigned int*, plcrash::async::plcrash_dwarf_cfa_reg_rule_t*, unsigned long long*) + 1285240
    3. 1  myapp                         0x10072c168 RuntimeInvoker_FalseVoid_t22962CB4C05B1D89B55A6E1139F0E87A90987017_RuntimeObject_SByte_t9070AEA2966184235653CB9B4D33B149CDA831DF(void (*)(), MethodInfo const*, void*, void**) + 23264 (Il2CppInvokerTable.cpp:23264)
    4. 2  myapp                         0x101065518 il2cpp::vm::Runtime::Invoke(MethodInfo const*, void*, void**, Il2CppException**) + 539 (Runtime.cpp:539)
    5. 3  myapp                         0x100d4b784 scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool) + 246 (ScriptingApi_Il2Cpp.cpp:246)
    6. 4  myapp                         0x100d5352c ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool) + 347 (ScriptingInvocation.cpp:347)
    7. 5  myapp                         0x100efe95c InvokeGameCenterCallback(char const*, ScriptingArguments const&) + 1368 (GameCenter.mm:1368)
    8. 6  myapp                         0x100efea10 GameCenter::ExecuteGameCenterCallbacks() + 1456 (GameCenter.mm:1456)
    9. 7  myapp                         0x100cc48cc ExecutePlayerLoop(NativePlayerLoopSystem*) + 347 (PlayerLoop.cpp:347)
    10. 8  myapp                         0x100cc4900 ExecutePlayerLoop(NativePlayerLoopSystem*) + 365 (PlayerLoop.cpp:365)
    11. 9  myapp                         0x100cc4ad8 PlayerLoop() + 45 (RecursionLimit.h:45)
    12. 10 myapp                         0x100e7fea0 UnityPlayerLoopImpl(bool) + 271 (LibEntryPoint.mm:271)
    13. 11 myapp                         0x1006ad104 UnityRepaint + 280 (UnityAppController+Rendering.mm:280)
    14. 12 myapp                         0x1006acfe0 -[UnityAppController(Rendering) repaintDisplayLink] + 72 (UnityAppController+Rendering.mm:72)
    15. 13 QuartzCore                     0x210755ff0 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 636
    16. 14 IOKit                          0x20c5a24b0 IODispatchCalloutFromCFMessage + 488
    17. 15 CoreFoundation                 0x20c2b119c __CFMachPortPerform + 188
    18. 16 CoreFoundation                 0x20c2d7da0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56
    19. 17 CoreFoundation                 0x20c2d74ec __CFRunLoopDoSource1 + 440
    20. 18 CoreFoundation                 0x20c2d2310 __CFRunLoopRun + 2096
    21. 19 CoreFoundation                 0x20c2d17c0 CFRunLoopRunSpecific + 436
    22. 20 GraphicsServices               0x20e4d279c GSEventRunModal + 104
    23. 21 UIKitCore                      0x23898ac38 UIApplicationMain + 212
    24. 22 myapp                         0x1006a4bb0 main + 41 (main.mm:41)
    25. 23 libdyld.dylib                  0x20bd958e0 start + 4
    I guess this crash related to Social.Authentication process.
    I'm thinking of re-writing my own native GameCenter implementation :|
     
  3. mmSimon

    mmSimon

    Joined:
    Aug 3, 2017
    Posts:
    3
    I'm also faced with this issue, have you had any luck @phuongnh ? It's a random crash so it's very hard to debug. I tried using lambda methods for the callback like other forum threads are suggesting and nothing seems to work ... :(

    Like you said I guess there's no way around but to code our own GameCenter implementation.


    EDIT: I just removed the LoadAchievements altogether. It kept crashing ... ¯\_(ツ)_/¯
     
    Last edited: Mar 26, 2020
    mahdie likes this.
  4. phuongnh

    phuongnh

    Joined:
    Sep 23, 2019
    Posts:
    22
    @mmSimon: I write it myself. It's simple as I only need to save the high scores. And then these crashes are gone away, you should give it a try ;)
     
    mahdie likes this.
  5. habitoti

    habitoti

    Joined:
    Feb 28, 2013
    Posts:
    141
    How did you do that?
     
  6. mahdie

    mahdie

    Joined:
    May 21, 2017
    Posts:
    7
    Yes @phuongnh, could you share with us what you did so that the issue was resolved. Also, I'm reading that the issue would be fixed in iOS 14, so, how could you be certain that the issue is resolved with your own handling of GameCenter?

    Thanks in advance.