Going back to ARKit view in Navigation Stack causes application crash with iPhone 14 Pro

We started detecting crashes with our iPhone 14 Pro and Pro Max devices when going back to an ARKit view in a navigation stack.

On going back to the view, the app crashes out.

we get stack traces similar to this:

Crashed: com.apple.arkit.capture 0 libsystem_kernel.dylib 0x7200 __pthread_kill + 8 1 libsystem_pthread.dylib 0x71ac pthread_kill + 268 2 libsystem_c.dylib 0x20ca0 abort + 180 3 AppleCV3D 0x16340e8 CV3DVIOAlignAndMergeMaps + 22728820 4 AppleCV3D 0xa8f3a8 CV3DVIOAlignAndMergeMaps + 10519348 5 AppleCV3D 0xa9c3fc CV3DVIOAlignAndMergeMaps + 10572680 6 AppleCV3D 0xa9c294 CV3DVIOAlignAndMergeMaps + 10572320 7 AppleCV3D 0xa9b934 CV3DVIOAlignAndMergeMaps + 10569920 8 AppleCV3D 0xa9cfcc CV3DVIOAlignAndMergeMaps + 10575704 9 AppleCV3D 0xad598 CV3DVIOAlignAndMergeMaps + 156964 10 ARKitCore 0x7d80 -[ARWorldTrackingTechnique processData:] + 4328 11 ARKitCore 0x6bdc -[ARParentTechnique processData:onTechniques:] + 188 12 ARKitCore 0x85b8 -[ARParentTechnique processData:] + 64 13 ARKitCore 0x6bdc -[ARParentTechnique processData:onTechniques:] + 188 14 ARKitCore 0x85b8 -[ARParentTechnique processData:] + 64 15 ARKitCore 0x8f58 -[ARSession sensor:didOutputSensorData:] + 728 16 ARKitCore 0x3664c -[ARDepthSensor pointCloudDataOutput:didOutputPointCloudData:timestamp:connection:] + 912 17 AVFCapture 0x6c9cc -[AVCapturePointCloudDataOutput _processSampleBuffer:] + 268 18 AVFCapture 0x6c724 __52-[AVCapturePointCloudDataOutput _updateRemoteQueue:]_block_invoke + 88 19 CMCapture 0x11ffd0 __FigRemoteOperationReceiverCreateMessageReceiver_block_invoke + 308 20 CMCapture 0x2e40fc __rqReceiverSetSource_block_invoke + 256 21 libdispatch.dylib 0x3fdc _dispatch_client_callout + 20 22 libdispatch.dylib 0x746c _dispatch_continuation_pop + 504 23 libdispatch.dylib 0x1aa58 _dispatch_source_invoke + 1588 24 libdispatch.dylib 0xb56c _dispatch_lane_serial_drain + 376 25 libdispatch.dylib 0xc214 _dispatch_lane_invoke + 436 26 libdispatch.dylib 0xd4f8 _dispatch_workloop_invoke + 1780 27 libdispatch.dylib 0x16e10 _dispatch_workloop_worker_thread + 652 28 libsystem_pthread.dylib 0xdf8 _pthread_wqthread + 288 29 libsystem_pthread.dylib 0xb98 start_wqthread + 8

I managed to reproduce the crash with a simple demo project, with some small modifications to an AR app XCode template. Simply adding the initial view to a UINavigationViewController, and having another view controller to push onto the stack after the AR view.

The issue only seems to happen on iPhone 14 Pro and iPhone 14 Pro max, older devices seem unaffected. At least, those are the latest iPhones we have here for testing.

I raised an issue using the feedback app, ref FB11595282, we really need to escalate this, but there doesn't seem to be a way to do it

We are also seeing several new ARKit related crashes with similar stack traces, some exclusively on iPhone 14, others on iOS 16 only. I have also filed a few bug reports:

  • "ARSession on run after pause from viewWillDisappear causes crash in AppleCV3D" - 11343731
  • "TrueDepth stream fails on iPhone 14 Pro after using an ARSession" - 11554045
  • "Modifying an ARSession that uses 'initialWorldMap' causes a unnecessary relocalization" - 11604874

For your situation, there might be a workaround. I'm guessing you are calling session.run() on viewWillAppear and session.pause() on viewWillDisappear, but keeping the same ARSession around. You can try creating a new ARSession on viewWillAppear rather than reusing the same one ( e.g. self.session = ARSession() )

Going back to ARKit view in Navigation Stack causes application crash with iPhone 14 Pro
 
 
Q