Search code examples
iosxcodeuikitxibxcode10

App crashes on devices running iOS 9.2.1 or lower (not P3 images)


After deploying update (no significant changes, bugfixes, migration to Swift 4.2) for the app for the first time using Xcode 10, the app started crashing everywhere (crash reports are not specific at all) on devices running iOS 9.2.1 or lower (on Simulator app works just fine, without any problems).

I know it can happen if you have images with P3 gamut (or 16-bit-per-component encoding), but this is not the case, as I checked all my image (and images from Pods), and there are none.

The Crash with most occurrences is:

Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000100045ad0

0  libobjc.A.dylib                0x19905dbd0 objc_msgSend + 16
1  UIKit                          0x18971bfb4 -[UINibStringIDTable lookupKey:identifier:] + 132
2  UIKit                          0x189717c04 -[UINibDecoder decodeObjectForKey:] + 48
3  UIKit                          0x1895f99e4 -[UIProxyObject initWithCoder:] + 104
4  UIKit                          0x189717fdc UINibDecoderDecodeObjectForValue + 672
5  UIKit                          0x189717d24 -[UINibDecoder decodeObjectForKey:] + 336
6  UIKit                          0x1895f9c38 -[UIRuntimeConnection initWithCoder:] + 188
7  UIKit                          0x1895fa3d8 -[UIRuntimeEventConnection initWithCoder:] + 68
8  UIKit                          0x189717fdc UINibDecoderDecodeObjectForValue + 672
9  UIKit                          0x189718154 UINibDecoderDecodeObjectForValue + 1048
10 UIKit                          0x189717d24 -[UINibDecoder decodeObjectForKey:] + 336
11 UIKit                          0x1895f8f6c -[UINib instantiateWithOwner:options:] + 1220
12 *app*                          0x1001405c8 CustomView.viewFromNibForClass() (CustomView.swift:52)
13 *app*                          0x100140890 CustomViewinit(_:) (CustomView.swift:36)

Custom view is class that loads file from XIB file, with owner on self. But I did not made any changes to this class or XIB file before deploying this version (this code is in production for 1 year or more and worked without any problems on iOS > 9.0).

But there are more crashes all over application's various parts. So what can be the problem?


Solution

  • It is backwards compatibility issue of asset catalogs in Xcode 10, it has been fixed in Xcode 10.1 beta 2 https://stackoverflow.com/a/52614882/3134625