Good use of breakpoints in Xcode - ios

Does anyone have a very specific use for Xcode breakpoints that they wanted to share? I am learning through http://www.swifteducation.github.io
The breakpoint isn't used to its full potential I believe and I wanted to have some creative feedback on this.

A little-known use for breakpoints is to use them as bookmarks for your code. I use them to quickly navigate to pieces of my code that I revisit a lot.
Just create a breakpoint as you would normally (click the gutter to the left of a line of code) and then disable it by right-clicking on it and selecting "Disable Breakpoint". You can display all the breakpoints by bringing up the Breakpoint Navigator with this hotkey:
⌘7 : Breakpoint Navigator
or just click on the breakpoint icon in the navigation bar on the left-hand side
screenshot here
Clicking on the breakpoint in the navigator will instantly take you to that line of code just like a bookmark.
Just remember to make sure they are disabled and light blue in colour otherwise they will cause your program to halt at that breakpoint.

Related

Assistant editor(Xcode 7.3) always showing interface file in storyboard , even when I choose manually

Even after deleting derived data many times, and trying other things, I am still facing this problem. Can you help me?
You can try using the shortcut key instead, to open up the assistant editor.
Shortcut key: -
option + click on the file which you want to open up in the assistant editor
Guys I just stop dealing with this problem by changing the settings in xcode 9.2. And now i use Navigation Pane.
Here is how it works :
Ok now if you go to xcode -> preferences -> navigation
and Choose the "Uses Focused Editor" as in the picture below.
Now you can manually select inside the Navigation Pane.
Just click whichever page you would like to change and select in the Navigation Pane.
Here is a few screenshots :
Pictures shows code files but it works with everything you can click in the Navigation Pane.
Try to drag and drop file from the Project Navigator into the path of the Assistant Editor as temporary fix.
You also can click on this icon to bring recent files.
Try to clean your project, clean Build Folder, restart Xcode.
Make sure the view controller in your Storyboard has correct custom class name.
I think I know the problem you're having. I experience it too, but it's intermittent. Sometimes clicking Manual shows me the entire project folder and I can select the editable classes, but other times it only shows the interface versions of them, which aren't editable and cannot have IBOutlets dragged to them (you can tell b/c it'll say internal class and has less code). I have noticed that if I toggle back and forth between Automatic and Manual, I can usually get the editable class to appear. I also will toggle the assistant editor off, select a different View Controller or two on the storyboard, then go back to my original one, turn the Assistant Editor back on, and it starts working again.
There are other discussions of it here, here, and here. This suggestion of turning off indexing sounds intriguing and worth a try if the problem keeps reappearing. UPDATE: This trick with hitting the + and opening a 2nd file, then closing the interface file, worked great when I tried it just now.
Here are pics of how the Automatic side shows the actual file when the Manual side only shows the interface, which says internal next to class:

Xcode variable debug inspector not working properly

No matter what I do, Xcode (bottom left below the editor) shows the value of self and my first variable in the unit I am trying to debug or step through instead of the variables I want to inspect.
What I have tried:
Restarted xcode
Clean + rebuild
Hover mouse over variable, click the down arrow (it seems like Xcode does not grab my click correctly, sort of hard to explain)
No tooltip is shown either when I hover over a variable. (I have tried to click the edior first to ensure it has focus.)
in the bottom left of the debug window, where it probably says Auto set that to all variables, registers... etc and see if it shows you what you are looking for, otherwise post a picture of what is happening

How to prevent debugger bar from appearing in Xcode 7?

The problem
I'm not sure how to prevent the debugger bar from appearing/disappearing for certain files. This is an issue that has occurred ever since I started using Xcode 7.
Why it is a problem
Two to three lines are selected in the editor after I tap in it, to switch from/to the assistant editor, as show in the attached image below.
Here is what I know about the issue so far:
I've looked online, and found no information on the issue.
The issue still occurs if I elect to show the Assistant Editor on the right.
Some files do not cause the debugger to show.
Even if I choose to hide the debugger in Behaviors, the issue still occurs.
If I use the activation button to show the debugger, and then try to drag it down, the bar sticks at the bottom, and does not disappear.
For files that don't show the debugger bar, I'm able to drag the debugger down and it hides completely.
This does not happen on Xcode 6.4.
This occurs on both OSX and iOS projects.
Ideal Solution
I'm looking for a way to hide the debugger completely, so that the editor doesn't freak out and select lines when I tap inside it. Any help is greatly appreciated!
After more experimenting in Xcode, I found a fix.
Here are the steps for anyone else who is having the same issue:
Delete the UI Testing target
If you are using UI Testing in the project, then re-create the UI Test target, and files will no longer show the debugger bar.
I went through a lot of permutations before finding this, and nothing else had any effect. However, I'm not sure how long this fix will last, since whatever bug in Xcode caused it to occur in the first place could cause it to surface again. This is especially true for projects that have a large amount of UI Testing.
Edit
The debugger bar does reappear for a new file, even after adding the UI Testing target had been removed and re-created for the project. This happens even if the new file isn't a view object.
The Xcode debugging tools are integrated throughout the Xcode main window but are primarily located in the Debug area, the debug navigator, the breakpoint navigator, and the source editor. The debugging UI is dynamic; it reconfigures as you build and run your app. To customize how Xcode displays portions of the UI, choose Xcode Preferences > Behaviors.

Xcode breakpoints greyed out and not working

I'm debugging an Objective-C app on the iPhone simulator. The app compiles and works. Xcode settings previously let me set debugger breakpoints and have the debugger actually break.
Now, the breakpoints show up in grey and the debugger doesn't stop on any breakpoint. Clicking on the breakpoint makes it light grey, but not blue like normal.
Can someone tell me which setting I need to revert to enable debugging again? Thanks.
Open your Debug Area:
Enable the Breakpoint and make it highlighted. BOOM!
In the top menu, open Debug and click Activate breakpoints. You can also use the keyboard shortcut: Command ⌘ + Y.
You should also be able to right click directly on the break point and choose "Enable Break Point" from the pop up menu.
OK...
You have all your breakpoints generally disabled. This will gray out and ignore breakpoints even if they individually say they are enabled.
Go to the Debug menu in Xcode and select Activate Breakpoints.

Xcode not displaying line number or exception in debugger output

For some reason, Xcode is not displaying the line number of the exception, or even the crash itself in the Debugger Output. I have no breakpoints set and it's being built for Debug. The debugger is set to LLDB. I'm not sure how this became onset, but it's badly affecting my workflow now.
This isn't how it was before (would display main.m), but I have no idea how it happened.
Turn off your breakpoints. Up in the top bar, unselect the button labeled Breakpoints.
You likely accidentally clicked on a line and enabled a breakpoint. Additionally, you can click on the button that looks like a play button with a line preceding it to continue the program execution. It is located on the bar above your console output.

Resources