16

With the release of iOS 9, we are seeing several crash reports for what appears to be a bug from Apple's side of things in iOS 9. This is happening across device types (iPhone, iPad and iPod). I am looking to find out why this may be happening and if there is anything I can do to work around it. This stack is being reported through our crash reporting system (Crashlytics) so unfortunately I don't have reproducible steps or code, but I will try and answer any questions as best as I can. The stack is as follows:

Thread : Crashed: com.apple.main-thread
0  libobjc.A.dylib                0x34a27ad6 objc_msgSend + 21
1  CoreFoundation                 0x230d3db9 -[__NSArrayM dealloc] + 148
2  libobjc.A.dylib                0x34a34f67 objc_object::sidetable_release(bool) + 150
3  libobjc.A.dylib                0x34a353a9 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 388
4  CoreFoundation                 0x230cbfa9 _CFAutoreleasePoolPop + 16
5  UIKit                          0x27523cd9 _prepareForCAFlush + 312
6  UIKit                          0x2752886b _beforeCACommitHandler + 10
7  CoreFoundation                 0x2317a509 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20
8  CoreFoundation                 0x2317880d __CFRunLoopDoObservers + 280
9  CoreFoundation                 0x23178c3f __CFRunLoopRun + 958
10 CoreFoundation                 0x230cc249 CFRunLoopRunSpecific + 520
11 CoreFoundation                 0x230cc035 CFRunLoopRunInMode + 108
12 GraphicsServices               0x2c182ad1 GSEventRunModal + 160
13 UIKit                          0x272e18a9 UIApplicationMain + 144
14 APPNAMEHERE                    0x000ec967 main (main.m:14)
Josh
  • 1,435
  • 12
  • 19

4 Answers4

2

For me the problem was that I was showing and dismissing the keyboard when the application was minimized.

[self.textView becomeFirstResponder];
[self.textView resignFirstResponder];

I performed the above code on the applicationWillResignActive event. removing this code fixed the crash.

shim
  • 9,289
  • 12
  • 69
  • 108
Tomer Even
  • 4,820
  • 2
  • 30
  • 36
1

We encountered the a crash with a similar stack trace, and after a long investigation we found out that it was related to an other crash; fixing that also fixed this, however I'm still unsure how the two crashes are related.

Here are the details about the other crash:

We had a function call in one of our methods like

AudioServicesAddSystemSoundCompletion(self.soundID,  
                                      [[NSRunLoop currentRunLoop] getCFRunLoop],  
                                      kCFRunLoopDefaultMode,  
                                      AudioServicesSystemSoundCompletion,  
                                      (void *)CFBridgingRetain(self)); 

where AudioServicesSystemSoundCompletion looked like

void AudioServicesSystemSoundCompletion(SystemSoundID ssID,  void *clientData) {  
     AudioServicesRemoveSystemSoundCompletion(ssID);  
     CFRelease(clientData);  
}

Executing that function call two or more times simultaneously caused the app to crash. We fixed this by passing NULL instead of (void *)CFBridgingRetain(self) and removing the CFRelease(clientData); line.

Since this fix we no longer see the '_prepareForCAFlush' crash anymore.

Also note that according to Crashlytics the device had very high memory usage each time the crash has reproduced.

Hope this helps!

petertoth
  • 249
  • 2
  • 6
  • We are testing some theories around what you are suggesting here, and if it works out I will let everyone know. We are not doing anything exactly like what you are here, but it does appear that something was being released at the wrong times in some of our code, and that might be the cause. Thanks for responding, and I hope to have definitive results in about a week. – Josh Oct 09 '15 at 16:06
  • Update. Our attempts at fixes have so far not resolved the problem. It is possible the things we have tried have helped some, but not significantly. I'm betting something is "leaking" and this is a crash when attempting to clean things up. No real idea how to ever find out what or why.... – Josh Oct 19 '15 at 22:57
  • What about now? We've been having the same issue and I have no idea what's causing it. – Alex Machado Nov 25 '15 at 21:31
  • Hey guys, have you figured this out? – arunit21 Sep 12 '17 at 14:25
1

I'm also facing this issue and I think that I found what might be causing it. Are you guys by any chance using SDWebImage? Because that's the only place where I found that CFRunLoopRun() is being called and also other people complained on: Dead thread ticket -> App Crash

-4

Seems to be only affecting devices with 32-bit processors A5 and A6 - iPod 5th Gen, iPhone 4S/5/5C, iPad 2/Mini). No repro on our side either. These crashes started and ramped up with iOS 9 release and adoption. iOS v9.0.1 does not seem to fix it.

Andrei A.
  • 7
  • 1
  • According to Fabric, 40% of the crashes belong to iPhone 6 and 25% to iPhone 6 plus – Efesus Oct 02 '15 at 21:04
  • Just to confirm, that it is 64-bit as well, as we have many iPhone 6 and 6 plus with this crash as well. Still trying to figure it out... – Josh Oct 03 '15 at 14:46