Invisible breakpoint in Xcode - ios

Xcode 6 have some strange break point issue. I have removed all break points from my project but still its hitting some invisible break point every time.
I have tried below things.
Commad + 7 and delete all break points.
(lldb) br delete
error: No breakpoints exist to be deleted.
I don't see any break point but still its hitting some break point. see below screenshots for reference.
..Nitin

This is not a breakpoint, but rather an exception in the view controller (whose name you've partially redacted here). Click on that second item in the stack trace, and it will like show you the offending line. Just go up the stack trace until you get to your own code.
It's hard to tell on the basis of so little information, but looking at the stack trace, the assembly code shown, and the exception, it looks like you've encountered a problem during a segue where a cast failed. Perhaps have a prepareForSegue method that is trying to cast segue.destinationViewController to a particular view controller class in order to pass some data to the destination, but the cast failed for some reason. Perhaps you neglected to set the base class for the destination scene in the storyboard.
But if you click on that second line in your stack trace (right below the currently highlighted line) and you'll probably be taken directly to the offending line of code.

There don't have to be any breakpoints set in you project to encounter this kind of behaviour. It means that the thread was aborted because of a fatal error. You just can't see the code, because it happened somewhere deeper in the system, so the Xcode only shows you the assembly code.
As I can see from your stack trace, these threads could be related to your question:
swift prepareForSegue not working / exc_breakpoint (code=exc_i386_bpt subcode=0x0)
Don't know what this means Thread 1: EXC_BREAKPOINT(code=EXC_1386_BPT,subcode=0x0)

Related

Breakpoint exception occurs on run in simulator and device

I am experiencing an exception at runtime in my appdelegate. It happens when I try to instantiate viewcontrollers in 2 places in the app, even though I instantiate viewcontrollers in many places with no problem. Also, when I comment out the lines where the exceptions occur, the exception just appears a few lines of code later.
I can't explain why this solution works but it appears to have solved the issue. When I remove customFonts from the sourcecode of my xib and storyboard files, the exceptions no longer occur.

App crashes in AppDelegate and cannot get past launch screen

The app crashes in AppDelegate, unable to get beyond the launch screen. No view controller code ever gets executed.
The stack trace is also not very helpful nor is the line highlighted in AppDelegate when the crash occurs.
Images below provide the details.
How to debug from here?
Check any IBOutlet links carefully; you may have deleted the property from your view controller but the UI element is still connected to it. This should give you an exception stating something like Class ViewController is not key value coding-compliant for key XXX where XXX is your bad IBOutlet, however Swift's exception reporting does seem to be a bit hit-and-miss at times.
Here's another possible cause related to the reason Paulw11 stated that may help someone else.
If you have segue's in your storyboard that links to a storyboard reference in another bundle, and you change the name of the bundle where the reference resides, make sure to update the Bundle name in your storyboard for the linked reference.
I have a framework I'm developing that contains some storyboards and UI components. I decided to rename the framework, updated the podfile references in the app and all the file imports to reflect the new framework name but completely forgot that there were storyboard references in the app referencing view controllers provided in storyboards in the framework.
Here's an example:
If you do not rename the reference you will experience a crash when you try to load the storyboard containing your link with no hint as to why. I spent an embarrassing amount of time hunting this down.

Weird crash while navigating back

My app crashes randomly when navigating back in a NavigationController. Here is what I know:
It happens randomly (sometimes, I can come back once or twice and if I reload the viewController and press "back" again it will crash)
It happens even with an empty ViewController (I tried to comment out all my code in ViewController.h and .m and to remove all the outlets links)
Nothing shows up in the debug console, only a EXEC_BAD_ACCESS is shown in main.m
I spent the afternoon on this and tried everything.
I don't include code right now because I have no idea where to look. As I said, it even happens with an empty ViewController.
Any thoughts or similar experience ?
EDIT:
Yes I tried to add an exception breakpoint
I even tried to find some observer issues with Spark debugger.
EDIT 2:
Actually, the ViewControllers were not that empty. The import on an UIView category was the problem. Check my answer below.
It's difficult to say exactly what could be causing it without more information, but in my experience the most common reason for an EXC_BAD_ACCESS is when someone tries to call a selector on a deallocated instance. This issue can be a lot easier to debug if you enable zombie objects.
Edit Scheme -> Diagnostics -> Enable Zombie Objects
Now instead of getting a bad access exception you should get a more helpful "message sent to deallocated instance" error (assuming that's actually the problem), along with what method was being called on which class of object.
The problem was that some of my views were importing a custom UIView category that included a dealloc method. I deleted the dealloc method from the category and everything is fine now.

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

Wheres my stack trace gone?

I'm not sure what I've done, how long it's been like this (as I've been putting up with it for a while)... but I've lost my stack trace in the debugger in Xcode...sort of. Below is a screen shot of what I see when my app crashes:
And in the console I see this:
So I can figure out what went wrong from the console, but I miss the stack trace that I could click on class files and jump to the source of the crash.
Could it be LLDB? Latest Xcode? Something else swallowing my exceptions? Any ideas?
The problem is that the debugger isn't stopping when the exception occurs, it is stopping when the program crashes. This happens after the the exception unwinds the stack, which means the source is no longer there. If you want the debugger to stop before the stack is unwound, you need to set a breakpoint when the exception is thrown. Xcode makes this easy. Go to the breakpoints section in the project window.
Then, click the + button in the bottom-left corner and choose "Add Exception Breakpoint…". Make sure that the new breakpoint is set to trigger on throw, or it will still occur after the stack is unwound.

Resources