iOS app crashing only when -Os compilator flag is being used (release build)

177 Views Asked by At

I'm currently compiling an iOS app with XCode 6.3.2 When compiled in Debug mode, it works fine on every device it runs on. When compiled in Release mode, it crashes but only on iPad Air 2 devices apparently (the app is iOS 8+ only btw).

After lots of experiments and trial and errors, I figured out that switching the compiler flag from -Os to -O0 makes the app work without problems on any device. It looks like a compiler bug but I'm having a hard time figuring out the reason why this happens. Crash logs are of no use as they do not show anything about the application code as they report the crash in Apple's frameworks instead. At this point I'm not even sure the crash report is reliable. Has this happened to anyone before?

Here's the crash log (cannot paste due to characters limits): https://gist.github.com/tanis2000/dc734a093fa85b9a363b

UPDATE

Here's another crash dump without Crashlytics in the way: https://gist.github.com/tanis2000/0280059f2cb8709b18b2

The app dies on

2015-06-24 10:35:44.723 SwagUp[1013:108392] -[LSApplicationProxy isDescendantOfView:]: unrecognized selector sent to instance 0x155e67f90

That looks like a problem with the way AutoLayout constraints are being solved on different devices though.

UPDATE 2

It turned out that the cause of the crash was an UIButton inside an UIView (inside other UIViews and so on) that didn't have any constraints itself. It's peculiar that Interface Builder didn't warn about the missing constraints. I still don't get why without optimizations it kept working fine though.

0

There are 0 best solutions below