Search code examples
ioscrashcore-foundationios13

iOS 13 - Crashed: com.apple.main-thread EXC_BREAKPOINT (CoreFoundation)


I have started getting huge number of the crash reported from Fabric for my iOS application which is already distributed on the App Store. Crashes are started reporting from 18 Sep onwards for iOS 13 only. Here is the crash log for the main thread which is getting crashed.

Crashed: com.apple.main-thread
0  CoreFoundation                 0x185180408 OUTLINED_FUNCTION_0 + 4
1  CoreFoundation                 0x18525bd68 __CFStringCollectionCopy.cold.1 + 14
2  CoreFoundation                 0x18525bd68 __CFStringCollectionCopy.cold.1 + 14
3  CoreFoundation                 0x18525bd68 __CFStringCollectionCopy.cold.1 + 14
4  CoreFoundation                 0x18525bd68 __CFStringCollectionCopy.cold.1 + 14
5  CoreFoundation                 0x18525bd68 __CFStringCollectionCopy.cold.1 + 14
6  CoreFoundation                 0x18525bd68 __CFStringCollectionCopy.cold.1 + 14
7  CoreFoundation                 0x18525bd68 __CFStringCollectionCopy.cold.1 + 14
8  CoreFoundation                 0x18525bd68 __CFStringCollectionCopy.cold.1 + 14
9  CoreFoundation                 0x18525bd68 __CFStringCollectionCopy.cold.1 + 14
10 CoreFoundation                 0x18525bd68 __CFStringCollectionCopy.cold.1 + 14

Anyone facing a similar crash? How can I get rid of this issue?


Solution

  • As par Alex's solution,

    It seems that the dyld3 saves the generated clojure files in the app tmp directory and if you use NSFileProtectionComplete the closure files have this property too.

    To generate a crahs close the app, lock the phone, send a push that will wake up the app and then the crash is generated.

    The solution seems to be simple, just change the permissions for the app tmp direcptry to NSFileProtectionCompleteUntilFirstUserAuthentication and the app will not crash. I really don't know why apple did this.

    This worked for me.

    Reproduction & Test

    Rayns comments

    You don't necessarily need to use push notifications to reproduce the issue. If your app is configured to use complete file protection in the entitlements, any code that runs while protected data is unavailable will cause the app to crash. For example, my company's app has a background task that takes longer than 10 seconds to execute. Since protected data becomes unavailable around 10 seconds after locking the device, the app will crash before the background task can finish executing (despite having more time available on the assertion).