touchlab / CrashKiOS

Crash reporting for Kotlin/Native iOS applications
https://crashkios.touchlab.co/
Apache License 2.0
258 stars 15 forks source link

App crashes at launch after App Thinning with CrashKiOS has a dependency #52

Closed orgmir closed 1 year ago

orgmir commented 1 year ago

Like the title says, distributing an iOS app with App Thinning crashes on launch if CrashKiOS is set as a dependency for the shared.framework.

I believe this is a Kotlin issue and I have opened KT-58461 with more information on how to replicate the crash.

Here is the sample repo https://github.com/Orgmir/symbol-not-found-crash and the steps to reproduce:

  1. Open Xcode project and archive the app (you will need a valid apple dev account)
  2. Distribute for Development, with App Thinning for "All compatible device variants"
  3. Install on device, by drag and drop in Finder for example
  4. Open the app 💥

The crash will be visible in the "Device logs" button, in "Devices" window in Xcode. The reason being "symbol not found in flat namespace (OBJC_CLASS$_FIRCrashlytics)".

The reason I am opening an issue here is that Kotlin folks closed the issue blaming Apple (which fair enough, App Thinning is a black box) but I am hoping we could figure out a workaround to get this to work.

My app uses Kotlin 1.8.21 and the shared.framework is dynamic. It needs to be dynamic because we bundle some resources with it. Removing CrashKiOS dependency makes the app not crash anymore!

Any idea of how I can make it not crash?

Other issues related to the same problem: https://github.com/rickclephas/NSExceptionKt/issues/12

orgmir commented 1 year ago

Figured out it is a build setup issue, more details here https://github.com/rickclephas/NSExceptionKt/issues/12#issuecomment-1551144580