sentry-cocoa: Crash when initialising a view controller with performance tracking enabled
Environment
How do you use Sentry? Sentry SaaS (sentry.io)
Which SDK and version? sentry-cocoa 7.3.0
Steps to Reproduce
- iOS 15
- Sentry 7.3.0
- As a workaround we disabled the network performance tracking as mentioned in: https://github.com/getsentry/sentry-cocoa/issues/1346
- In the SDK initialisation:
SentrySDK.start { options in
// Temporary workaround to avoid memory crashes
// See: https://github.com/getsentry/sentry-cocoa/issues/1346
// Disable network tracking integration:
options.integrations = options.integrations?.filter { $0 != "SentryNetworkTrackingIntegration" }
}
Expected Result
Sentry would work with deactivated network performance tracking
Actual Result
Sentry crashing quite often, when initialisation ViewControllers.
Sentry issue message:
NSInternalInconsistencyException
UIViewController is missing its initial trait collection populated during initialization. This is a serious bug, likely caused by accessing properties or methods on the view controller before calling a UIViewController initializer. View controller: <MyViewController: 0x10101a000>
Stack trace from a reproduced crash via TestFlight.

Raw Crash log, retrieved from Sentry:
Seem like the swizzling of VCs is giving problems in iOS 15, regarding the non-intialized trait collection(s)
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 19 (11 by maintainers)
Thanks, I’m gonna investigate more into it.
thanks for digging into this, that crashlog you posted on the apple forums looks very similar to the one i was experiencing. what seems strange is that the crash disappeared once i downgraded my sentry version.
i’m releasing a TestFlight later today, i’ll add
@objcto my initializer, and re-upgrade to 7.4.0 and see if i still experience a crashoh yeah! my VC in question totally has a custom initializer
that might be it
in my case, why it doesn’t crash on the first init of that VC confuses me