iOS app crashes on device with no crash info
My app is crashing on the device after I repeat a certain sequence of actions a few times, generally it occurs after a memory level of one is triggered, and开发者_Python百科 always occurs when one of the view is being loaded. This problem cannot be reproduced in the Simulator.
There are minor memory leaks upon each execution, but memory usage is quite low (as shown in Allocations and Leaks). I have stripped down the code, but the problem persists.
The issue is debugging the problem as there is no message in the console and no crash log.
Any suggestions?
Searching for memory leaks is discussed here - Memory leak detection tools in Xcode.
Memory leaks can be hard to find since they can cause unpredictable effects. Use the Leak tool in xcode and go through your code. It may be worth looking through the programming guide on memory management as you may be releasing something when you shouldn't be (or the other way around). The problem may not necessarily be where you think.
I think it's going to take you meticulously going through your code and checking everything, even if you think something is working the way it should be, just check to be sure - you may be surprised to find that it's not.
OpenGL can cause obscure crashes.
I had a retain cycle in my OpenGL code.
This happened in my custom UIView, where I had a GLKView
subview. This subview could never be released, leading to a crash. Solution was to use weak
instead of strong
.
@property (strong, nonatomic) GLKView* glkView; // Crash, no crash report, no errors
@property (weak, nonatomic) GLKView* glkView; // this works
There was no errors in the log. No crash report. I have exceptions enabled to break on throw, but no exceptions were thrown. I had inserted NSLog's everywhere, but it didn't reveal anything useful. I had zombies enabled, but didn't notice anything unusual.
精彩评论