Since 8.26 it is no longer possible to use a custom NSApplication subclass while initializing Sentry before that class is initialized, because Sentry calls [SentryCrashExceptionApplication sharedApplication] as part of its initialization and thereby registers SentryCrashExceptionApplication as NSApplication instance.
This was caused by #3957. The fix is to e.g. have Sentry call [SentryCrashExceptionApplication class] instead.
Create custom NSApplication subclass inheriting from SentryCrashExceptionApplicationregister it as "Principal class" in Info.plist
Initialize SentrySDK before application class is initialized (e.g. from +initialize)
Expected Result
NSApplication subclass is initialized normally.
Actual Result
SentryCrashExceptionApplication is registered as application instance.
Demo project
The following project illustrates the issue. Notice how [MyApplication init] is never called, even tho MyApplication is registered as principal class.
SentryApplicationTest.zip
Platform
macOS
Environment
Production, Develop, TestFlight
Installed
Swift Package Manager
Version
8.26
Xcode Version
15.4
Did it work on previous versions?
8.25
Steps to Reproduce
Since 8.26 it is no longer possible to use a custom NSApplication subclass while initializing Sentry before that class is initialized, because Sentry calls
[SentryCrashExceptionApplication sharedApplication]
as part of its initialization and thereby registersSentryCrashExceptionApplication
as NSApplication instance.This was caused by #3957. The fix is to e.g. have Sentry call
[SentryCrashExceptionApplication class]
instead.SentryCrashExceptionApplication
register it as "Principal class" in Info.plist+initialize
)Expected Result
NSApplication subclass is initialized normally.
Actual Result
SentryCrashExceptionApplication is registered as application instance.
Demo project
The following project illustrates the issue. Notice how
[MyApplication init]
is never called, even thoMyApplication
is registered as principal class. SentryApplicationTest.zipAre you willing to submit a PR?
yes