How to track the exact issue for the crash in iOS - ios

When I was debugging my iPhone app, I got an error and the app got crashed. I have added a exception break point but it didn't point any where in the code and crashed in main.m.
Here I am adding the screen shot of the XCode window when the app crashed.
How can I find the exact issue for the crash from this?
Is it possible? Please help.

Enable Zoombie so that you will get the error description in log.
If you edit the scheme you want to turn on zombies for (in the "Product" menu, select "Edit Scheme"), go to the "Run Foo.app" stage in the left panel, and the "Arguments" tab on the right. You can then add NSZombieEnabled to the "Environment Variables" section and set the value to YES, as you could in Xcode 3.
In Xcode 4.1 and above, there's also checkbox on the "Diagnostics" tab of the "Run" stage to "Enable Zombie Objects".

click on EditScheme in XCode. then screen will be show like below. click on Enable Zombie Objects.It will shows error on your log.

Add an Exception breakpoint and the debugger will stop on the line that crashes.

Not sure but reading the registers might help.
First go to Exceptions tab and 'Add Exception Breakpoint' using the + at the bottom left corner.
Then when the app crashes click on "0 objc_exception_throw" under Thread 1
Finally in the console enter:
register read
(you should get a list of registers)
po $rax (normally the exception is in 'rax')
(you should see the exception output on the console)
Hope this helps.

Related

XCode App randomly crashing - message sent to deallocated instance

I am getting the following error on my app when it randomly crashes during testing.
The logs show the following:
Is there any way possible I can track why this error is apprearing? I'll be super grateful.
Best.
Go to the Breakpoint Navigator. Click the plus sign on the bottom left. Add exception breakpoint. It will break right before the weird error you are seeing :)
You know the pane on the left that shows your files? At the top of it there are 7 buttons or so, and one is shaped like a breakpoint. That's the navigator.

How to find EXC_BAD_ACCESS variable from memory address in XCode6? [screenshot included]

This EXC_BAD_ACCESS error pops up once every 5~8 runs.
I am aware that it's caused by duplicate or bad variable usages, etc.
But I can't find exactly WHERE it is causing this error from my codes.
Is there a way to find out which variable is causing such problem?
You can use Zombie to get symbolicated info related to crash
Enable Zombie Objects by-
And then, checking the Enable Zombie Objects checkbox,
Run(profile) your project in simulator -
The instruments will be launched as-
Instruments would show a message similar to the following:
Your next step should be to set an exception breakpoint in Xcode. When your app crashes, Xcode will pause your app at the point where the crash occurs. To set an exception breakpoint, open the breakpoint navigator by choosing View > Navigators > Show Breakpoint Navigator. Click the + button at the bottom of the navigator and choose Add Exception Breakpoint.

How to set the exception breakpoint in xcode 6

hi after crashing i set the exception break point by pressing break point symbol and i choose objective c language while editing the break point. I run it again ,app is crashed ,but it is not stopped where the exception is occurred in xcode6
Thanks in advance.
Ok than try using enabling zombie environment.
Follow these steps:
Click on project name and edit scheme.
A pop over will appear, In that select Arguments tab. See bottom section Environment Variables. You can see + button at bottom part. Click on that button and add varialbe NSZombieEnabled with value YES.
Now from same popover select Diagnostics tab. And mark Enable Zombie Objects.
Click close and again run your project, hope this will track down zombie objects at runtime which cause runtime crash.
See the following steps.
Look into [Navigator] and Click on [Show the Breakpoint Navigator].
See the bottom of Navigator [ + ] Sign. Click on it
Select [Add Exception Breakpoint].
Your Exception Breakpoint are activated from this things.

Enable and Debug Zombie objects in iOS using Xcode 5.1.1

I have an iOS(7.1) app which crashes due to EXC_BAD_ACCESS. If I am not wrong, this happens due to the use of an object which is already de-allocated. After a bit of searching, I found out that enabling Zombie objects help to pin point the line of error. As I am using xcode 5.1.1, I have done the following to Enable Zombie Objects.
And then, checking the Enable Zombie Objects checkbox,
Then I went to Instruments panel, selected Zombies,clicked Profile and got this,
Now the simulator (in the left background), which had a button and a textfield is running blank and also I can't understand anything on the Instruments panel.
What should be the next step? I mean how can I get the lines which are causing the bad access? I am stuck on this for hours but still couldn't find the procedure.
Any help is appreciated.
Accessing a deallocated object is not the only reason you would get EXC_BAD_ACCESS. Other causes of bad access errors include accessing nil pointers and going past the bounds of an array.
Looking at your screenshots, you are not using a deallocated object. If you were using a deallocated object, the Zombies template in Instruments would let you know. Instruments would show a message similar to the following:
Your next step should be to set an exception breakpoint in Xcode. When your app crashes, Xcode will pause your app at the point where the crash occurs. To set an exception breakpoint, open the breakpoint navigator by choosing View > Navigators > Show Breakpoint Navigator. Click the + button at the bottom of the navigator and choose Add Exception Breakpoint.

How do I delete a breakpoint marker in xcode?

So my app is 100% done, however when I compile it in xcode the app loads up normal, but when I press the button, which is the apps main function, it encounters a thread breakpoint error and I'm not sure why.
When I run the app by itself in the simulator without xcode it runs perfect, the thread error only happens when I run it in xcode.
Thanks again for any help that can be provided!
Click on that dark blue arrow next to the "Play Sound" comment, and it will turn light blue (disabled). Or right click (or option-click) on the blue arrow and you have an option to remove the breakpoint.
Or select the breakpoint navigator ("View" - "Navigators" - "Show Breakpoint Navigator") and manage your breakpoints there.
See WWDC 2012 video Debugging in Xcode.
Your app stops when running in the debugger because you have set a breakpoint at that line. Delete or disable the breakpoint. There is nothing wrong here and there is no error. The debugger is doing exactly what you told it to do.
In XCode 9 the easiest way to delete breakpoint is to just left-click and drag it.

Resources