简体   繁体   中英

App crashes with no exception or crash log

My app crashes, but generates no exception in the console and no crash log on the device. No memory warnings are received. Is there any way I can narrow down the cause without having to comment out code?

Stepping through the code should help you nail down where the app is crashing, this will stop the program execution before it hits any "bad" code (providing you put the breakpoint - where the code will stop in the right place). You can add a break point by clicking on the appropriate line number to the left of the code editing pane and can access the break points organiser through the View->Navigators->Show Breakpoint Navigators menu.

You may have some inkling of the method or class that's currently being executed in which case you should put a break point on the first line of that method, if the class is a UIViewController then putting the break point on the first line of it's -(void)viewDidLoad method may help. You could, at a push, put your breakpoint on the first line of -(void)applicationDidFinishLaunching in the application delegate. However this will require a lot of stepping into instructions rather than just stepping over instructions.

https://developer.apple.com/library/mac/#documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/Debugging/Debugging.html

Apple also suggest turning on the static analyser and then inferring problems in your code from it's output.

崩溃的原因是我使用NSLog记录了一个非常大的阵列-不知道这可能会使应用程序崩溃!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM