iOS 9 Crashing in _prepareForCAFlush with EXC_BAD_ACCESS KERN_INVALID_ADDRESS

前端 未结 4 1873
不思量自难忘°
不思量自难忘° 2021-01-07 23:42

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 (iPh

4条回答
  •  南方客
    南方客 (楼主)
    2021-01-07 23:54

    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!

提交回复
热议问题