XCode App randomly crashing - message sent to deallocated instance - ios

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.

Related

Thread1: Breakpoint 1.4 [duplicate]

I am following the Stanford University iOS development course on iTunes U.
In one of the demos (that I have been trying to follow), there is this code that loads the property list from an NSURL and returns it as NSMutableDictionary.
-(NSMutableDictionary *) words
{
NSURL *wordsURL=[NSURL URLWithString:#"http://cs193p.stanford.edu/vocabwords.txt"];
words=[[NSMutableDictionary dictionaryWithContentsOfURL:wordsURL] retain];
return words;
}
The application is successfully built, but at runtime it gives the following error and gets stuck:
I can't figure out what the problem is. Can you please help?
You're stopped at a breakpoint. That's a debugging tool, not an error. See the blue arrow/tab in the left margin, where the line numbers are? Drag that away and drop it anywhere (you'll see a "poof") to remove it, then run your project again.
You can also deactivate all breakpoints by typing ⌘-Y, the key equivalent for the menu item Debug>Deactivate Breakpoints, or you can view all your breakpoints in the Breakpoint Navigator (hit ⌘-6).
When execution stops like this, you can continue from the breakpoint, either by typing continue at the debugger prompt in the Console:
(lldb) continue
Or hitting the "Play" button in the debugger controls. You can also type Control-⌘-Y, which is the equivalent for the menu item Debug>Continue.
This isn't an error. You just set a breakpoint (probably without knowing it).
Drag the little blue Chevron in the column at the left out of the way. You will see it disappear and go poof, and then you can rebuild your app and you should see it run properly.
Now, that said, I think there are some memory management mistakes in your code, but we can return to those later. ;-)
The program is stopping because you have a breakpoint.. That's the blue arrow on the left of the code. Right-click it and delete.

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.

App pausing but not getting an error after running a clean

I have no idea what is after going wrong but I'll state the events that happened before the error occurred
1: App was running fine as I was adding functionality.
2: I noticed that one of the view controllers was not showing the correct version but an older one. (I had added in a segmented control and it wasn't showing up)
3: I tried to uninstall the from my phone and build it again but it was still showing the old controller
4: I tried cleaning the project to recompile everything, after this step the application started to give me this problem
http://i.imgur.com/105yDr8.png
Some extra information:
1: This error occurs on the black screen before any view controllers load
2: The view controller I was working on was not the first view controller (so I do not think that it is the problem)
3: The main view controller has not been changed in days and was working perfectly since it was finished
I have absolutely no idea what is going wrong, and help would be greatly appreciated
UPDATE 1
New error message
http://i.imgur.com/5XVJWHT.png
UPDATE 2
Screenshot of storyboard and a finder window that opened when I clicked "show in finder on the storyboard". This would lead me to believe that it does know where the file is
http://i.imgur.com/Ybas1Yx.png
You've (probably accidentally) set a breakpoint at the return UIApp...-line.
You can identify a breakpoint by it's blue color at the left of a line. If it's activated, it's dark blue, else it's light blue. You can just drag it either to the trash can or somewhere else in your window to completely delete the breakpoint.
your app is getting crashed due to exception check the pannel objc_exception_throw
add exception breakpoint and you'll get the line of code where your app is crashing
It sounds like something is broken, and throws an exception. You're just seeing the exception being caught.
The way to investigate what is throwing is to add an exception breakpoint. Go to the breakpoints list and hit +, choose exception breakpoint and leave it at all. This should give you a breakpoing at the point where the except is being thrown.
As to what is happening. You had an app that ran with an old VC, you deleted the app and re-installed and now it crashes, so best guess is that your old version had the VC, but new one doesn't. Sounds like a missing xib or storyboard. It clearly isn't missing from the project, as you'd see that immediately, but check for target membership, changed name or localization problems.
I fixed the problem by renaming the storyboard to MainStoryboard1 and changing the target in
project > target > summary > iphone/ipod deployment

How to track the exact issue for the crash in 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.

Resources