iOS 14 crashes on UIHostingController.didMove(toParent:)

We're getting crash reports of our iOS app. We know approximately where in the app is having the issue but we could not reproduce it. The stack trace from one of the reports is attached.

  • The crash is reported from iOS 14 only but not iOS 15. We still need to fix it or work around it for users of iOS 14.
  • Searching in the forum found some similar issues about unowned variables but not this deep into the SwiftUI and UIKit code. We have also fixed a lot weak references.
  • Noticed UIHostingController.updateKeyboardShortcutManagement() in stack trace. We don't use keyboard shortcuts directly. Is there a way to avoid this call or is it always called by UIHostingController.didMove(toParent:)?

Any help is appreciated.

iOS 14 crashes on UIHostingController.didMove(toParent:)
 
 
Q