ARDK iOS Application Crashes on Application 'Force Close'

Include the following details while filing a bug report (edit as applicable):

  • Issue category: ARDK Builds
  • Device type & OS version: iOS
  • Host machine & OS version: Mac
  • Issue Environment : On Device
  • Xcode version: 13.3
  • ARDK version: 1.2
  • Unity version: 2021.2.3f1

How to Reproduce:

  1. Build Unity project
  2. Run project targeting iOS device (any)
  3. Close application on simulator.
  4. Notice App Crash.

Crash Screenshot:

Crash Report:

Date/Time: 2022-03-11 18:21:46.7955 -0800
Launch Time: 2022-03-11 18:20:35.2145 -0800
OS Version: iPhone OS 15.1 (19B74)
Release Type: User
Baseband Version: 3.00.00
Report Version: 104

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 12

Thread 0 name:
Thread 0:
0 libsystem_asl.dylib 0x00000001a071d748 DYLD-STUB$$pthread_mutex_lock + 8
1 libsystem_asl.dylib 0x00000001a071c8a8 closelog + 28 (syslog.c:256)
2 libsystem_c.dylib 0x000000018b8338d4 __cxa_finalize_ranges + 476 (atexit.c:286)
3 libsystem_c.dylib 0x000000018b82e228 exit + 32 (exit.c:78)
4 UIKitCore 0x0000000183d52f68 -[UIApplication _terminateWithStatus:] + 504 (UIApplication.m:6927)
5 UIKitCore 0x000000018343dd14 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 128 (_UISceneLifecycleMultiplexer.m:808)
6 UIKitCore 0x0000000183632c5c -[_UISceneLifecycleMultiplexer forceExitWithTransitionContext:scene:] + 224 (_UISceneLifecycleMultiplexer.m:482)
7 UIKitCore 0x0000000183d4fae4 -[UIApplication workspaceShouldExit:withTransitionContext:] + 212 (UIApplication.m:3828)
8 FrontBoardServices 0x0000000192512c38 __63-[FBSWorkspaceScenesClient willTerminateWithTransitionContext:]_block_invoke_2 + 80 (FBSWorkspaceScenesClient.m:331)
9 FrontBoardServices 0x00000001924cd6b4 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 240 (FBSWorkspace.m:352)
10 FrontBoardServices 0x0000000192512bd0 __63-[FBSWorkspaceScenesClient willTerminateWithTransitionContext:]_block_invoke + 132 (FBSWorkspaceScenesClient.m:328)
11 libdispatch.dylib 0x0000000180667660 _dispatch_client_callout + 20 (object.m:560)
12 libdispatch.dylib 0x000000018066b118 _dispatch_block_invoke_direct + 264 (queue.c:489)
13 FrontBoardServices 0x00000001924cef94 FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 48 (FBSSerialQueue.m:157)
14 FrontBoardServices 0x00000001924ce3d4 -[FBSSerialQueue _targetQueue_performNextIfPossible] + 220 (FBSSerialQueue.m:181)
15 FrontBoardServices 0x00000001924d29e4 -[FBSSerialQueue _performNextFromRunLoopSource] + 28 (FBSSerialQueue.m:194)
16 CoreFoundation 0x0000000180a17020 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 28 (CFRunLoop.c:1972)
17 CoreFoundation 0x0000000180a27ce0 __CFRunLoopDoSource0 + 208 (CFRunLoop.c:2016)
18 CoreFoundation 0x0000000180961fe8 __CFRunLoopDoSources0 + 268 (CFRunLoop.c:2053)
19 CoreFoundation 0x00000001809677f4 __CFRunLoopRun + 820 (CFRunLoop.c:2951)
20 CoreFoundation 0x000000018097b3b8 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
21 GraphicsServices 0x000000019c30b38c GSEventRunModal + 164 (GSEvent.c:2200)
22 UIKitCore 0x000000018331b6a8 -[UIApplication _run] + 1100 (UIApplication.m:3493)
23 UIKitCore 0x000000018309a7f4 UIApplicationMain + 2092 (UIApplication.m:5046)
24 UnityFramework 0x0000000104defca0 -[UnityFramework runUIApplicationMainWithArgc:argv:] + 108 (main.mm:96)
25 galleryv1 0x0000000102c87e1c main + 68 (main.mm:26)
26 dyld 0x0000000102ee9a24 start + 520 (dyldMain.cpp:876)

Thread 1:
0 libsystem_pthread.dylib 0x00000001f0c95e8c start_wqthread + 0

Thread 2:
0 libsystem_pthread.dylib 0x00000001f0c95e8c start_wqthread + 0

Thread 3:
0 libsystem_pthread.dylib 0x00000001f0c95e8c start_wqthread + 0

Thread 4 name:
Thread 4:
0 libsystem_kernel.dylib 0x00000001b78371a4 __ulock_wait + 8
1 libdispatch.dylib 0x0000000180668054 _dlock_wait + 56 (lock.c:326)
2 libdispatch.dylib 0x0000000180667df8 _dispatch_thread_event_wait_slow + 56 (lock.c:366)
3 libdispatch.dylib 0x0000000180676b9c DISPATCH_WAIT_FOR_QUEUE + 364 (lock.h:330)
4 libdispatch.dylib 0x0000000180676744 _dispatch_sync_f_slow + 144 (queue.c:1762)
5 ardk_client_platform 0x0000000106fe4ba0 _NARPlatformUtils_GetInterfaceOrientation + 148
6 libdispatch.dylib 0x0000000180665914 _dispatch_call_block_and_release + 32 (init.c:1517)
7 libdispatch.dylib 0x0000000180667660 _dispatch_client_callout + 20 (object.m:560)
8 libdispatch.dylib 0x000000018066ede4 _dispatch_lane_serial_drain + 672 (inline_internal.h:2601)
9 libdispatch.dylib 0x000000018066f958 _dispatch_lane_invoke + 392 (queue.c:3937)
10 libdispatch.dylib 0x000000018067a1a8 _dispatch_workloop_worker_thread + 656 (queue.c:6727)
11 libsystem_pthread.dylib 0x00000001f0c960f4 _pthread_wqthread + 288 (pthread.c:2541)
12 libsystem_pthread.dylib 0x00000001f0c95e94 start_wqthread + 8

Thread 5 name:
Thread 5:
0 libsystem_kernel.dylib 0x00000001b7836504 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x00000001b7836b9c mach_msg + 76 (mach_msg.c:119)
2 CoreFoundation 0x0000000180963688 __CFRunLoopServiceMachPort + 372 (CFRunLoop.c:2646)
3 CoreFoundation 0x000000018096797c __CFRunLoopRun + 1212 (CFRunLoop.c:3000)
4 CoreFoundation 0x000000018097b3b8 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
5 Foundation 0x0000000182196354 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 236 (NSRunLoop.m:373)
6 Foundation 0x00000001821d7c28 -[NSRunLoop(NSRunLoop) runUntilDate:] + 92 (NSRunLoop.m:420)
7 UIKitCore 0x00000001832948a4 -[UIEventFetcher threadMain] + 524 (UIEventFetcher.m:1167)
8 Foundation 0x00000001821e636c NSThread__start + 808 (NSThread.m:972)
9 libsystem_pthread.dylib 0x00000001f0c969a4 _pthread_start + 148 (pthread.c:891)
10 libsystem_pthread.dylib 0x00000001f0c95ea0 thread_start + 8

Thread 6 name:
Thread 6:
0 libsystem_kernel.dylib 0x00000001b7836504 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x00000001b7836b9c mach_msg + 76 (mach_msg.c:119)
2 CoreFoundation 0x0000000180963688 __CFRunLoopServiceMachPort + 372 (CFRunLoop.c:2646)
3 CoreFoundation 0x000000018096797c __CFRunLoopRun + 1212 (CFRunLoop.c:3000)
4 CoreFoundation 0x000000018097b3b8 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
5 AudioSession 0x0000000189d0f308 CADeprecated::GenericRunLoopThread::Entry(void*) + 164 (GenericRunLoopThread.h:95)
6 AudioSession 0x0000000189d18d64 CADeprecated::CAPThread::Entry(CADeprecated::CAPThread*) + 92 (CAPThread.cpp:324)
7 libsystem_pthread.dylib 0x00000001f0c969a4 _pthread_start + 148 (pthread.c:891)
8 libsystem_pthread.dylib 0x00000001f0c95ea0 thread_start + 8

Thread 7:
0 libsystem_kernel.dylib 0x00000001b7836540 semaphore_wait_trap + 8
1 UnityFramework 0x0000000105ba9588 0x104dd8000 + 14488968
2 UnityFramework 0x0000000105bc5b50 0x104dd8000 + 14605136
3 libsystem_pthread.dylib 0x00000001f0c969a4 _pthread_start + 148 (pthread.c:891)
4 libsystem_pthread.dylib 0x00000001f0c95ea0 thread_start + 8

Thread 8 name:
Thread 8:
0 libsystem_kernel.dylib 0x00000001b7836504 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x00000001b7836b9c mach_msg + 76 (mach_msg.c:119)
2 CoreFoundation 0x0000000180963688 __CFRunLoopServiceMachPort + 372 (CFRunLoop.c:2646)
3 CoreFoundation 0x000000018096797c __CFRunLoopRun + 1212 (CFRunLoop.c:3000)
4 CoreFoundation 0x000000018097b3b8 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
5 CoreFoundation 0x00000001809fba78 CFRunLoopRun + 64 (CFRunLoop.c:3293)
6 CoreMotion 0x000000018d95b544 CLMotionCore::runMotionThread(void*) + 1204 (CLMotionCore.mm:370)
7 libsystem_pthread.dylib 0x00000001f0c969a4 _pthread_start + 148 (pthread.c:891)
8 libsystem_pthread.dylib 0x00000001f0c95ea0 thread_start + 8

Thread 9:
0 libsystem_kernel.dylib 0x00000001b7836f90 __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x00000001f0c9d254 _pthread_cond_wait + 1228 (pthread_cond.c:636)
2 libc++.1.dylib 0x0000000199103e78 std::__1::condition_variable::__do_timed_wait(std::__1::unique_lockstd::__1::mutex&, std::__1::chrono::time_point<std::__1::chrono::system_clock, std::__1::chrono::duration<long long, std::__1::r… + 100 (__threading_support:443)
3 ardk_client_platform 0x0000000107ebe8f8 0x106fb0000 + 15788280
4 libsystem_pthread.dylib 0x00000001f0c95ea0 thread_start + 8

Thread 10:
0 libsystem_kernel.dylib 0x00000001b7836540 semaphore_wait_trap + 8
1 UnityFramework 0x0000000105ba9588 0x104dd8000 + 14488968
2 UnityFramework 0x0000000105bc5b50 0x104dd8000 + 14605136
3 libsystem_pthread.dylib 0x00000001f0c969a4 _pthread_start + 148 (pthread.c:891)
4 libsystem_pthread.dylib 0x00000001f0c95ea0 thread_start + 8

Thread 11 name:
Thread 11:
0 libsystem_kernel.dylib 0x00000001b7838570 write$NOCANCEL + 8
1 libsystem_c.dylib 0x000000018b8269f8 __swrite + 24 (stdio.c:71)
2 libsystem_c.dylib 0x000000018b81b99c _swrite + 108 (stdio.c:133)
3 libsystem_c.dylib 0x000000018b81c874 __sflush + 232 (fflush.c:149)
4 libsystem_c.dylib 0x000000018b83bbc0 _fwalk + 80 (fwalk.c:65)
5 libsystem_c.dylib 0x000000018b832f1c abort + 112 (abort.c:85)
6 libsystem_c.dylib 0x000000018b88996c __assert_rtn + 300 (assert.c:96)
7 ardk_client_platform 0x0000000107f3cd94 0x106fb0000 + 16305556
8 ardk_client_platform 0x00000001079c5ba8 zsock_set_sndtimeo + 184
9 ardk_client_platform 0x00000001079a7e14 0x106fb0000 + 10452500
10 libsystem_pthread.dylib 0x00000001f0c969a4 _pthread_start + 148 (pthread.c:891)
11 libsystem_pthread.dylib 0x00000001f0c95ea0 thread_start + 8

Thread 12 name:
Thread 12 Crashed:
0 libsystem_kernel.dylib 0x00000001b783c964 __pthread_kill + 8
1 libsystem_pthread.dylib 0x00000001f0c9c378 pthread_kill + 268 (pthread.c:1610)
2 libsystem_c.dylib 0x000000018b832f50 abort + 164 (abort.c:118)
3 libsystem_c.dylib 0x000000018b88996c __assert_rtn + 300 (assert.c:96)
4 ardk_client_platform 0x0000000107f3cd94 0x106fb0000 + 16305556
5 ardk_client_platform 0x00000001079c5ba8 zsock_set_sndtimeo + 184
6 ardk_client_platform 0x00000001079a7e14 0x106fb0000 + 10452500
7 libsystem_pthread.dylib 0x00000001f0c969a4 _pthread_start + 148 (pthread.c:891)
8 libsystem_pthread.dylib 0x00000001f0c95ea0 thread_start + 8

Thread 13:
0 libsystem_pthread.dylib 0x00000001f0c95e8c start_wqthread + 0

Thread 14:
0 libsystem_pthread.dylib 0x00000001f0c95e8c start_wqthread + 0

Thread 15 name:
Thread 15:
0 libsystem_kernel.dylib 0x00000001b7836504 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x00000001b7836b9c mach_msg + 76 (mach_msg.c:119)
2 CoreFoundation 0x0000000180963688 __CFRunLoopServiceMachPort + 372 (CFRunLoop.c:2646)
3 CoreFoundation 0x000000018096797c __CFRunLoopRun + 1212 (CFRunLoop.c:3000)
4 CoreFoundation 0x000000018097b3b8 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
5 CoreFoundation 0x00000001809fba78 CFRunLoopRun + 64 (CFRunLoop.c:3293)
6 ANEServices 0x00000001c063a900 H11ANE::H11ANEServicesThreadStart(H11ANE::H11ANEServicesThreadParams*) + 132 (H11ANEServicesPrivate.mm:148)
7 libsystem_pthread.dylib 0x00000001f0c969a4 _pthread_start + 148 (pthread.c:891)
8 libsystem_pthread.dylib 0x00000001f0c95ea0 thread_start + 8

Thread 16:
0 libsystem_pthread.dylib 0x00000001f0c95e8c start_wqthread + 0

Thread 17 name:
Thread 17:
0 libsystem_kernel.dylib 0x00000001b7836504 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x00000001b7836b9c mach_msg + 76 (mach_msg.c:119)
2 CoreFoundation 0x0000000180963688 __CFRunLoopServiceMachPort + 372 (CFRunLoop.c:2646)
3 CoreFoundation 0x000000018096797c __CFRunLoopRun + 1212 (CFRunLoop.c:3000)
4 CoreFoundation 0x000000018097b3b8 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
5 AVFCore 0x0000000189d6279c -[AVRunLoopCondition _waitInMode:untilDate:] + 412 (AVRunLoopCondition.m:174)
6 AVFCapture 0x000000019f428b84 -[AVCaptureSession _stopFigCaptureSession] + 436 (AVCaptureSession.m:2014)
7 AVFCapture 0x000000019f40b8b8 -[AVCaptureSession _setRunning:] + 180 (AVCaptureSession.m:2086)
8 ARKitCore 0x00000001b4f9add8 -[ARParentImageSensor stop] + 552 (ARParentImageSensor.m:294)
9 ARKitCore 0x00000001b4f3d5b8 -[ARSession _stopAllSensors] + 604 (ARSession.m:4040)
10 ARKitCore 0x00000001b501f2d8 __18-[ARSession pause]_block_invoke + 132 (ARSession.m:879)
11 libdispatch.dylib 0x0000000180665914 _dispatch_call_block_and_release + 32 (init.c:1517)
12 libdispatch.dylib 0x0000000180667660 _dispatch_client_callout + 20 (object.m:560)
13 libdispatch.dylib 0x000000018066ede4 _dispatch_lane_serial_drain + 672 (inline_internal.h:2601)
14 libdispatch.dylib 0x000000018066f98c _dispatch_lane_invoke + 444 (queue.c:3937)
15 libdispatch.dylib 0x000000018067a1a8 _dispatch_workloop_worker_thread + 656 (queue.c:6727)
16 libsystem_pthread.dylib 0x00000001f0c960f4 _pthread_wqthread + 288 (pthread.c:2541)
17 libsystem_pthread.dylib 0x00000001f0c95e94 start_wqthread + 8

Thread 18:
0 libsystem_pthread.dylib 0x00000001f0c95e8c start_wqthread + 0

Thread 12 crashed with ARM Thread State (64-bit):
x0: 0x0000000000000000 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x0000000000000000
x4: 0x0000000000000000 x5: 0x00000001030f8750 x6: 0x0000000000000008 x7: 0x0000000000000000
x8: 0xb05296eb639ca7e4 x9: 0xb05296ea0c9157e4 x10: 0x000000000000000c x11: 0x000000000000000a
x12: 0x0000000000000000 x13: 0x0000000000000033 x14: 0x0000000042447000 x15: 0x0000000000047000
x16: 0x0000000000000148 x17: 0x000000016f0df000 x18: 0x0000000000000000 x19: 0x0000000000000006
x20: 0x000000000000bc03 x21: 0x000000016f0df0e0 x22: 0x00000001080f4db5 x23: 0x0000000000000000
x24: 0x00000001d7774000 x25: 0x0000000000000000 x26: 0x0000000000000000 x27: 0x0000000000000000
x28: 0x0000000000000000 fp: 0x000000016f0deea0 lr: 0x00000001f0c9c378
sp: 0x000000016f0dee80 pc: 0x00000001b783c964 cpsr: 0x40000000
esr: 0x56000080 Address size fault

Binary Images:
0x102c80000 - 0x102c87fff galleryv1 arm64 <0c6b2bf76a823a248b49668fea2a160e> /private/var/containers/Bundle/Application/24B80CE7-5CC0-4FFD-B11B-E3A1ADB0A279/galleryv1.app/galleryv1
0x102ed0000 - 0x102f27fff dyld arm64e /usr/lib/dyld
0x104dd8000 - 0x1068cffff UnityFramework arm64 <9553a7f0fcb23031a2c6b8bb103cc190> /private/var/containers/Bundle/Application/24B80CE7-5CC0-4FFD-B11B-E3A1ADB0A279/galleryv1.app/Frameworks/UnityFramework.framework/UnityFramework
0x106fb0000 - 0x1082f7fff ardk_client_platform arm64 /private/var/containers/Bundle/Application/24B80CE7-5CC0-4FFD-B11B-E3A1ADB0A279/galleryv1.app/Frameworks/ardk_client_platform.framework/ardk_client_platform
0x180663000 - 0x1806a9fff libdispatch.dylib arm64e /usr/lib/system/libdispatch.dylib
0x18095c000 - 0x180daffff CoreFoundation arm64e /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
0x18217e000 - 0x182483fff Foundation arm64e /System/Library/Frameworks/Foundation.framework/Foundation
0x182e02000 - 0x184686fff UIKitCore arm64e <8388eb03002b3b35a78a6a022894292e> /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
0x189d09000 - 0x189d32fff AudioSession arm64e <99ff741f34943edf82b7c03c916ebad3> /System/Library/PrivateFrameworks/AudioSession.framework/AudioSession
0x189d33000 - 0x189f44fff AVFCore arm64e /System/Library/PrivateFrameworks/AVFCore.framework/AVFCore
0x18b813000 - 0x18b891fff libsystem_c.dylib arm64e <30a1668a329d30009f747b42b21fe0fd> /usr/lib/system/libsystem_c.dylib
0x18d948000 - 0x18dc54fff CoreMotion arm64e <7464cd4b1ec7342392ce51becea40ca3> /System/Library/Frameworks/CoreMotion.framework/CoreMotion
0x1924c3000 - 0x19256efff FrontBoardServices arm64e <6fdec0c3e5003e06948ee34bda520801> /System/Library/PrivateFrameworks/FrontBoardServices.framework/FrontBoardServices
0x1990fa000 - 0x19915dfff libc++.1.dylib arm64e <255864c483d93bac8c7aad1b2d8a60cc> /usr/lib/libc++.1.dylib
0x19c30a000 - 0x19c312fff GraphicsServices arm64e <44e4515eb18737f18fe028e7b087daf5> /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
0x19f3d7000 - 0x19f4d3fff AVFCapture arm64e <111e54c321dd3ab28eb926c92768717e> /System/Library/PrivateFrameworks/AVFCapture.framework/AVFCapture
0x1a0707000 - 0x1a071efff libsystem_asl.dylib arm64e /usr/lib/system/libsystem_asl.dylib
0x1b4f18000 - 0x1b51b3fff ARKitCore arm64e <2505585a69c533d1b350a9db9b68c25e> /System/Library/PrivateFrameworks/ARKitCore.framework/ARKitCore
0x1b7835000 - 0x1b7868fff libsystem_kernel.dylib arm64e /usr/lib/system/libsystem_kernel.dylib
0x1c062a000 - 0x1c0647fff ANEServices arm64e /System/Library/PrivateFrameworks/ANEServices.framework/ANEServices
0x1f0c95000 - 0x1f0ca0fff libsystem_pthread.dylib arm64e <1a4a45fd1bb639df84140590ce103717> /usr/lib/system/libsystem_pthread.dylib

EOF

I was able to reproduce the same errors on a fresh project using:

  • ARDK v1.3
  • Unity 2021.2.5f1
  • iOS Build
  • ARDK Example Projects

Prerequisites

  1. Apple MacBook M1 Pro
  2. iPhone 13 with latest iOS

Steps to reproduce:

  1. Download ARDK 1.3
  2. Download ARDK Example Projects
  3. Create new 3D Unity Project for 2021.2.5f1 Apple Silicon
  4. Import ARDK 1.3 and ARDK Example Projects
  5. Follow steps to add ARDK App Token
  6. Open the Plane Anchors Sample Scene
  7. Setup build settings for iOS using these docs: Niantic AR Development Kit (ARDK): Building ARDK Apps for iOS
  8. Build project
  9. Plug in your iPhone into your Mac
  10. Target the application on Xcode to run on your iPhone
  11. Use the app on your iPhone
  12. Close the app on your iPhone
  13. See errors on Xcode

Attaching video on what the actions look like running the app locally on your iPhone device to reproduce.

Hi Lucas,
I have followed the steps you have provided, but am unable to recreate the crash or the error that you have provided. My setup is a Macbook pro with Intel chip and the app is built on Unity 2020.3.33. Niantic recommends M1 users to continue using 2020.3 LTS until M1 can be fully supported, and so it may resolve your issue if you try running it on that version of Unity instead of 2021. You can refer to the announcement of M1 support here.