Cryptic Crash on iOS 16.2 SwiftUI That Only Happens On Some Devices

Wondering if anyone can help me figure out what could cause this crash? It seems to happen only on one of my coworkers iPhone 13 running iOS 16.2 my phone is a iPhone 11 Max Running iOS 16.1 and this crash is not happening.

#0	(null) in UIKitNavigationBridge.containingNavControllerFromLastAttemptedPop.getter ()
#1	(null) in UIKitNavigationBridge.containingNavControllerFromLastAttemptedPop.getter ()
#2	(null) in UIKitNavigationBridge.isInTransientPop.getter ()
#3	(null) in UIHostingController.resolveRequiredBridges(in:allowedActions:) ()
#4	(null) in UIHostingController.didMove(toParent:) ()
#5	(null) in @objc UIHostingController.didMove(toParent:) ()
#6	(null) in -[UIViewController removeChildViewController:notifyDidMove:] ()
#7	(null) in -[UINavigationController removeChildViewController:notifyDidMove:] ()
#8	(null) in -[UIViewController dealloc] ()
#9	(null) in -[UINavigationController viewDidDisappear:] ()
#10	(null) in -[UIViewController _setViewAppearState:isAnimating:] ()
#11	(null) in __52-[UIViewController _setViewAppearState:isAnimating:]_block_invoke_2 ()
#12	(null) in __52-[UIViewController _setViewAppearState:isAnimating:]_block_invoke ()
#13	(null) in __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ ()
#14	(null) in -[__NSSingleObjectArrayI enumerateObjectsWithOptions:usingBlock:] ()
#15	(null) in -[UIViewController _setViewAppearState:isAnimating:] ()
#16	(null) in -[UIViewController __viewDidDisappear:] ()
#17	(null) in -[UIViewController _endAppearanceTransition:] ()
#18	(null) in __97-[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:]_block_invoke_3 ()
#19	(null) in -[UIViewController _executeAfterAppearanceBlock] ()
#20	(null) in -[_UIAfterCACommitBlock run] ()
#21	(null) in -[_UIAfterCACommitQueue flush] ()
#22	(null) in _runAfterCACommitDeferredBlocks ()
#23	(null) in _cleanUpAfterCAFlushAndRunDeferredBlocks ()
#24	(null) in _UIApplicationFlushCATransaction ()
#25	(null) in _UIUpdateSequenceRun ()
#26	(null) in schedulerStepScheduledMainSection ()
#27	(null) in runloopSourceCallback ()
#28	(null) in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#29	(null) in __CFRunLoopDoSource0 ()
#30	(null) in __CFRunLoopDoSources0 ()
#31	(null) in __CFRunLoopRun ()
#32	(null) in CFRunLoopRunSpecific ()
#33	(null) in GSEventRunModal ()
#34	(null) in -[UIApplication _run] ()
#35	(null) in UIApplicationMain ()
#36	(null) in closure #1 in KitRendererCommdowon(_:) ()
#37	(null) in runApp<A>(_:) ()
#38	(null) in static App.main() ()
#39	0x0000000100466550 in static AppRoot.$main() at AppRoot.swift:13
#40	(null) in main ()
#41	(null) in start ()

Replies

If anyone else runs into this ^ I found a working solution here: https://developer.apple.com/forums/thread/716310

This is the code that worked in my case:

struct NavStackWorkaround<T: View>: View {
  let content: ()->T
   
  var body: some View {
    if #available(iOS 16, *) {
      NavigationStack(root: content)
    } else {
      NavigationView(content: content)
        .navigationViewStyle(.stack)
    }
  }
}