I get an error "fatal error: unexpectedly found nil while unwrapping an Optional value" while running my app and I do not know where in the app the error has occurred.
I have two view controllers, and the error for sure doesn't occur in the first view controller because the view of the second controller appears and I also tested with break points in view will appear in the second view controller and everything works fine.
But now I do not know where to put breakpoints in the second view controller. Up to viewDidLoad and viewWillAppear everything works fine, but at the didRecievememoryWarning method the error comes back up again.
Do I have to place break points all over the file and find out which line is causing the error, or is there a quicker way to find out which is the exact line that is causing the error.
cmd+7. click on the top-most "Build $APP" section. locate the warning or error. click the buttons on the right to see the full details of the step you are interested in.
To find out where the error occurs, you could "open the call stack (Debug > Window > Call Stack) to see what functions are causing the problem. You can double click any line in the call stack to jump to the code and look at variable values from that method in the debugger.
Conversation. Xcode tip #5: If you have a Swift file with many errors, you can use Xcode's fix-its to try to correct them one by one. But a faster way is to go to the Editor menu and choose Fix All Issues to apply fix-its all at once. (Make sure and double-check which changes were made!)
In Objective-C, you can print the call stack by doing the following: NSLog(@"%@", [NSThread callStackSymbols]);
That crash should show up in the debug navigator. It shows you the instruction that caused the crash.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With