Unity Game Crashes After GameCenter Login Attempt

We have Apple Unity Plugins imported to our project. We only include Apple.Core and Apple.GameKit. We have tried to import Empty 3D URP Sample Project and project worked on iOS but when we try to build for our project we got this error. On Empty Project, we just import the Apple Plugins, nothing about authentication or login to Apple Game Center. But in our main project, we login to Apple Game Center.

We disabled the GameCenter Login code and game opens perfectly. No errors. The main problem is app crashes when we attempt to login to Apple Game Center.

Do you have any suggestions for this?

Unity: 2022.3.1f1 LTS (Current Latest LTS)

OS: macOS Ventura 13.4 (Latest Stable)

XCode: 14.3.1 (Latest Stable)

Apple Plugins: Apple.Core 1.0.3 - Apple.GameKit 1.0.4 (Latest)

Accepted Reply

Here is the logs

thread #1: tid = 0xa0213f, 0xffffff8000000002, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=257, address=0x8000000000000002)

(lldb) bt all
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=257, address=0x8000000000000002)
    frame #0: 0xffffff8000000002
    frame #1: 0x0000000104a3875c GameKitWrapper`closure #1 (Swift.Optional<Foundation.URL>, Swift.Optional<Foundation.Data>, Swift.Optional<Foundation.Data>, Swift.UInt64, Swift.Optional<Swift.Error>) -> () in GameKitWrapper.GKLocalPlayer_FetchItems(taskId: Swift.Int64, onSuccess: @convention(c) (Swift.Int64, Swift.UnsafeMutablePointer<Swift.Int8>, Swift.UnsafeMutablePointer<Swift.UInt8>, Swift.Int32, Swift.UnsafeMutablePointer<Swift.UInt8>, Swift.Int32, Swift.UInt) -> (), onError: @convention(c) (Swift.Int64, Swift.UnsafeMutableRawPointer) -> ()) -> () + 784
    frame #2: 0x0000000104a387f8 GameKitWrapper`partial apply forwarder for closure #1 (Swift.Optional<Foundation.URL>, Swift.Optional<Foundation.Data>, Swift.Optional<Foundation.Data>, Swift.UInt64, Swift.Optional<Swift.Error>) -> () in GameKitWrapper.GKLocalPlayer_FetchItems(taskId: Swift.Int64, onSuccess: @convention(c) (Swift.Int64, Swift.UnsafeMutablePointer<Swift.Int8>, Swift.UnsafeMutablePointer<Swift.UInt8>, Swift.Int32, Swift.UnsafeMutablePointer<Swift.UInt8>, Swift.Int32, Swift.UInt) -> (), onError: @convention(c) (Swift.Int64, Swift.UnsafeMutableRawPointer) -> ()) -> () + 28
    frame #3: 0x0000000104a38964 GameKitWrapper`reabstraction thunk helper from @escaping @callee_guaranteed (@in_guaranteed Swift.Optional<Foundation.URL>, @guaranteed Swift.Optional<Foundation.Data>, @guaranteed Swift.Optional<Foundation.Data>, @unowned Swift.UInt64, @guaranteed Swift.Optional<Swift.Error>) -> () to @escaping @callee_unowned @convention(block) (@unowned Swift.Optional<__C.NSURL>, @unowned Swift.Optional<__C.NSData>, @unowned Swift.Optional<__C.NSData>, @unowned Swift.UInt64, @unowned Swift.Optional<__C.NSError>) -> () + 352
    frame #4: 0x00000001c98f7610 GameCenterFoundation`__60-[GKLocalPlayer fetchItemsForIdentityVerificationSignature:]_block_invoke + 260
    frame #5: 0x0000000198c5c704 CoreFoundation`__invoking___ + 148
    frame #6: 0x0000000198c08b6c CoreFoundation`-[NSInvocation invoke] + 428
    frame #7: 0x00000001c995fcc8 GameCenterFoundation`-[NSInvocation(GKProxyHelpers) _gkInvokeOnce] + 24
    frame #8: 0x00000001c994a2b8 GameCenterFoundation`__53-[GKDaemonProxy connection:handleInvocation:isReply:]_block_invoke + 28
    frame #9: 0x00000001a01c04b4 libdispatch.dylib`_dispatch_call_block_and_release + 32
    frame #10: 0x00000001a01c1fdc libdispatch.dylib`_dispatch_client_callout + 20
    frame #11: 0x00000001a01d07f4 libdispatch.dylib`_dispatch_main_queue_drain + 928
    frame #12: 0x00000001a01d0444 libdispatch.dylib`_dispatch_main_queue_callback_4CF + 44
    frame #13: 0x0000000198c826f8 CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
    frame #14: 0x0000000198c64058 CoreFoundation`__CFRunLoopRun + 2036
    frame #15: 0x0000000198c68ed4 CoreFoundation`CFRunLoopRunSpecific + 612
    frame #16: 0x00000001d1f66368 GraphicsServices`GSEventRunModal + 164
    frame #17: 0x000000019b1473d0 UIKitCore`-[UIApplication _run] + 888
    frame #18: 0x000000019b147034 UIKitCore`UIApplicationMain + 340
    frame #19: 0x000000010dcf9594 UnityFramework`-[UnityFramework runUIApplicationMainWithArgc:argv:] + 92
  * frame #20: 0x0000000102b3bccc "*Project Name*"`main(argc=<unavailable>, argv=<unavailable>) at main.mm:26:9 [opt]
    frame #21: 0x00000001b72d0960 dyld`start + 2528

Replies

Here is the logs

thread #1: tid = 0xa0213f, 0xffffff8000000002, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=257, address=0x8000000000000002)

(lldb) bt all
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=257, address=0x8000000000000002)
    frame #0: 0xffffff8000000002
    frame #1: 0x0000000104a3875c GameKitWrapper`closure #1 (Swift.Optional<Foundation.URL>, Swift.Optional<Foundation.Data>, Swift.Optional<Foundation.Data>, Swift.UInt64, Swift.Optional<Swift.Error>) -> () in GameKitWrapper.GKLocalPlayer_FetchItems(taskId: Swift.Int64, onSuccess: @convention(c) (Swift.Int64, Swift.UnsafeMutablePointer<Swift.Int8>, Swift.UnsafeMutablePointer<Swift.UInt8>, Swift.Int32, Swift.UnsafeMutablePointer<Swift.UInt8>, Swift.Int32, Swift.UInt) -> (), onError: @convention(c) (Swift.Int64, Swift.UnsafeMutableRawPointer) -> ()) -> () + 784
    frame #2: 0x0000000104a387f8 GameKitWrapper`partial apply forwarder for closure #1 (Swift.Optional<Foundation.URL>, Swift.Optional<Foundation.Data>, Swift.Optional<Foundation.Data>, Swift.UInt64, Swift.Optional<Swift.Error>) -> () in GameKitWrapper.GKLocalPlayer_FetchItems(taskId: Swift.Int64, onSuccess: @convention(c) (Swift.Int64, Swift.UnsafeMutablePointer<Swift.Int8>, Swift.UnsafeMutablePointer<Swift.UInt8>, Swift.Int32, Swift.UnsafeMutablePointer<Swift.UInt8>, Swift.Int32, Swift.UInt) -> (), onError: @convention(c) (Swift.Int64, Swift.UnsafeMutableRawPointer) -> ()) -> () + 28
    frame #3: 0x0000000104a38964 GameKitWrapper`reabstraction thunk helper from @escaping @callee_guaranteed (@in_guaranteed Swift.Optional<Foundation.URL>, @guaranteed Swift.Optional<Foundation.Data>, @guaranteed Swift.Optional<Foundation.Data>, @unowned Swift.UInt64, @guaranteed Swift.Optional<Swift.Error>) -> () to @escaping @callee_unowned @convention(block) (@unowned Swift.Optional<__C.NSURL>, @unowned Swift.Optional<__C.NSData>, @unowned Swift.Optional<__C.NSData>, @unowned Swift.UInt64, @unowned Swift.Optional<__C.NSError>) -> () + 352
    frame #4: 0x00000001c98f7610 GameCenterFoundation`__60-[GKLocalPlayer fetchItemsForIdentityVerificationSignature:]_block_invoke + 260
    frame #5: 0x0000000198c5c704 CoreFoundation`__invoking___ + 148
    frame #6: 0x0000000198c08b6c CoreFoundation`-[NSInvocation invoke] + 428
    frame #7: 0x00000001c995fcc8 GameCenterFoundation`-[NSInvocation(GKProxyHelpers) _gkInvokeOnce] + 24
    frame #8: 0x00000001c994a2b8 GameCenterFoundation`__53-[GKDaemonProxy connection:handleInvocation:isReply:]_block_invoke + 28
    frame #9: 0x00000001a01c04b4 libdispatch.dylib`_dispatch_call_block_and_release + 32
    frame #10: 0x00000001a01c1fdc libdispatch.dylib`_dispatch_client_callout + 20
    frame #11: 0x00000001a01d07f4 libdispatch.dylib`_dispatch_main_queue_drain + 928
    frame #12: 0x00000001a01d0444 libdispatch.dylib`_dispatch_main_queue_callback_4CF + 44
    frame #13: 0x0000000198c826f8 CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
    frame #14: 0x0000000198c64058 CoreFoundation`__CFRunLoopRun + 2036
    frame #15: 0x0000000198c68ed4 CoreFoundation`CFRunLoopRunSpecific + 612
    frame #16: 0x00000001d1f66368 GraphicsServices`GSEventRunModal + 164
    frame #17: 0x000000019b1473d0 UIKitCore`-[UIApplication _run] + 888
    frame #18: 0x000000019b147034 UIKitCore`UIApplicationMain + 340
    frame #19: 0x000000010dcf9594 UnityFramework`-[UnityFramework runUIApplicationMainWithArgc:argv:] + 92
  * frame #20: 0x0000000102b3bccc "*Project Name*"`main(argc=<unavailable>, argv=<unavailable>) at main.mm:26:9 [opt]
    frame #21: 0x00000001b72d0960 dyld`start + 2528

GKLocalPlayer.Local.FetchItems()

When we try to call FetchItems() app crashes.

Same issue here. Did you get a solution?

This issue has been resolved

https://blog.csdn.net/Yj_sail/article/details/135277886?spm=1001.2014.3001.5502