I updated to Xcode 8.3.3 and updated my OS, a bunch of pods, and so on. Now when I crash on unexpectedly found nil it takes me to a stack trace with it stopped on 'exc_breakpoint' (see screen shot). I have no breakpoints set.
I can't effectively troubleshoot these 'nil' errors because I don't know where they're occurring in my project (I can do it slowly by using a back trace and trying to sort through the messages, but this is way slower than if it just landed me on the right line like it used to do.)
Do I have some setting turned on by accident? Is this a bug? How can I get Xcode to go straight to the line of the nil crash?
Thanks!
Yes, I'm also faced this issues in my project. I just used to solve this by setting breakpoint in my code and I run manually line by line. Finally it will shows the nil value passing line.
If I faced crash issue while clicking any action button i will set breakpoint and run it line by line.
else if I faced crash issue while page loading. I will set breakpoint in viewdidload & viewdidappear
else I will set breakpoint in functions.
or try to use exception breakpoint
Through this above method I will solve crash issue in my project.
Related
I am using Xcode 9.3. I was using Xcode 9.2.
In 9.2, when an exception occurred, the debugger showed the line that caused the exception in the editor area, and I would see the variables and their values, plus the console in the debug area.
I did not change anything, and yet, now, I get the stack trace in the editor area. Given that the error is a simple "found nil when unwrapping a variable" and is an explicit error in a single line of code, the stack trace is next to useless in finding this. In fact, in looking at the stack trace and variables, the only variable that is nil is not a variable that is created within the method that the stack highlights.
Since then, I have enabled Zombies. I have had to re-add an All Exceptions break point (why does it forget these between versions is a whole other question) set to "on Throw".
I have deleted Derived Data, cleans the build, restarted Xcode, restarted the Mac and made various rude gestures to my screen. The last helped a bit, however the rest achieved nothing.
Any further suggestions?
I had downloaded XCode 7.1.1
When I put the break point and run the application, instead of going to breakpoint line of the code, its showing something like in the screen and also when there is a crash at that time debug is coming like this.
I would like to know how to goto the line of the code and also how to check in which line the crash is taking place.
Can anyone help me, I had enabled Address Sanitizer then also its not going to the code
i am getting a pretty generic error in my debugger when using the simulator in xCode.
plugin com.XXX.XXX.Shortcut-Keyboard invalidated
this just started occurring yesterday and i don't believe i changed anything. since the error started i had just added a few more outlets and actions. i did try something in the code which changed the first responder on a text field, but i have since removed that code and recompiled. It seems maybe this caused an issue? Now when i cycle thru the keyboards, when it gets to mine i get a few second pause and then this error. in debugging the code, it never seems to hit my viedDidLoad override in my keyboard view controler. So something i did must have changed it.
What would cause something like this to occur? I'm at a loss! Im using Xcode 6.3.1 with a target of 8.3 on an iPad. Any help would be appreciated as this is holding up my development.
Thanks
Mike
start a new project and copy and paste the code resolved this issue
Since I've upgraded from xcode 3.1 to xcode 4.2, when I debug a program and for some reason I get a SIGABRT error (i.e. calling a method of an object that doesn't exist) Xcode shows the error in the main function of the program, instead of the line that is generating the SIGABRT.
Maybe I'm missing some kind of configuration in the debugger or in xcode? any ideas?
I had the same problem for a long time and I found a solution just now. Don't know if it's the most kosher way, but at least it works for me. Basically you should create a global breakpoint (global meaning applying to all your projects).
Check out this blog post, and this tutorial on how to create symbolic breakpoints. I myself created an Exception breakpoint (it catches objc_exception_throw too) this way:
and then moved it to "User" breakpoints space:
Make sure that the scheme you are using has breakpoints active. You can turn them on by hitting the button next to the scheme selector.
http://bit.ly/zuTnpF
What did it for me, was something that I found here that has to do with creating NSZombies
I'll at least copy the highlights:
Go to your project in Xcode 4
Environment variables can be set up in the Scheme editor (find Product -> Edit scheme… in menu bar):
Name the variable as NSZombieEnabled and set its value to YES.
Run your app in Debug mode. You likely get a … message sent
to deallocated instance… message and the debugger stops at the line in error. This information leads to the problem.
When ready, disable NSZombieEnabled by changing YES to NO.
When I crash (for reasons I understand; that's not the problem) when I try to do something Cocoa isn't okay with, such as calling a method that doesn't exist or attempting to insert nil into a set, the debugger shows the stack from main() to __pthread_kill, without any of the frames that were present when the actual crashing code ran. There is a frame (9th from main) called objc_exception_rethrow. This leads me to believe that Cocoa Touch is trying to do something or other to recover all exceptions and die gracefully or something. However, it is very irritating when debugging to not have the ability to actually use Xcode4's debugging tools to investigate the calling stack frames, or even see where in my code I crashed.
Is there some way to make the objc_exception_rethrow behavior not happen, and just crash as soon as an exception is raised? Perhaps there's a debug setting that makes it crash earlier (at the right time)? (I haven't messed with any of the build settings in this project yet.)
I don't know any Xcode setting that could disable re-throwing exceptions. To my knowledge they are re-thrown by the runtime. You could try running the app without the debugger attached and let it crash. The crash report should contain a section "Last Exception Backtrace" which will give you exactly what you need in this case.
I found the answer: set a breakpoint on Obj-C Exceptions. It will go to the debugger when objc_exception_throw is hit, which is good. Unfortunately, this happens before the exception is printed, but we can make that happen anyway (most of the time) by setting the breakpoint's action to be (Debugger Action) po *(id *)($ebp + 8).