You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Change the Principal Class to SentryCrashExceptionApplication, as described here.
Run the app
See the attached sample project, which should reproduce the issue.
Expected Result
The app should launch when run.
Actual Result
The app crashes on launch. Nothing appears in the Xcode console, but in the macOS console, we see this:
Unable to find class: SentryCrashExceptionApplication, exiting
I suspect that because there is no reference to SentryCrashExceptionApplication in the code, the class was never linked in from the static library, and thus is not present at runtime. If I add any reference to SentryCrashExceptionApplication in the code, it launches correctly. For example, I can add this:
Note, though, that if this reference were optimized out by the compiler, then the app might crash again. (Hence the need to actually print it.)
It would be nice if Sentry itself could reference SentryCrashExceptionApplication on macOS, so that it is seen as a transitive dependency and thus would be linked in when other Sentry APIs are referenced. Alternatively, if referencing SentryCrashExceptionApplication in code is necessary, this should be documented.
Are you willing to submit a PR?
I'd be willing to, but it's not clear what route the team wants to take
The text was updated successfully, but these errors were encountered:
Hello @bjhomer, this happens because the compiler is stripping the lib from unused code.
You can solve this by adding a reference to SentryCrashExceptionApplication somewhere in your code just like this:
Right, and I noted that in my ticket. This should perhaps be documented, though, as right now, following the instructions leads to an app that won't launch.
Platform
macOS
Environment
Production, Develop, TestFlight
Installed
Swift Package Manager
Version
8.25.0
Did it work on previous versions?
8.21.0
Steps to Reproduce
SentryCrashExceptionApplication
, as described here.See the attached sample project, which should reproduce the issue.
Expected Result
The app should launch when run.
Actual Result
The app crashes on launch. Nothing appears in the Xcode console, but in the macOS console, we see this:
I suspect that because there is no reference to
SentryCrashExceptionApplication
in the code, the class was never linked in from the static library, and thus is not present at runtime. If I add any reference toSentryCrashExceptionApplication
in the code, it launches correctly. For example, I can add this:Note, though, that if this reference were optimized out by the compiler, then the app might crash again. (Hence the need to actually
print
it.)It would be nice if Sentry itself could reference
SentryCrashExceptionApplication
on macOS, so that it is seen as a transitive dependency and thus would be linked in when other Sentry APIs are referenced. Alternatively, if referencingSentryCrashExceptionApplication
in code is necessary, this should be documented.Are you willing to submit a PR?
I'd be willing to, but it's not clear what route the team wants to take
The text was updated successfully, but these errors were encountered: