Correcting Errors and Warnings in the Issue Navigator
As you write your code, Xcode is sitting in the background judging you, but do not take it personally—it only wants to help. Xcode analyzes your code and detects issues that might be (or are) problems and displays warnings and errors before you ever click the Run button.
You can receive three general types of feedback from Xcode when it analyzes your application: errors, warnings, and logic problems. Warnings are potential problems that might cause your application to misbehave; a yellow caution sign warns you of these. Errors, however, are complete showstoppers. You cannot run your application if you have an error. The symbol for an error, appropriately enough, is a red stop sign.
Logic problems, found by the Xcode analyze process, are shown as a blue badge. All of these bugs, across all your files, are consolidated in the Issue Navigator. The Issue Navigator displays automatically if problems are found during a build or analyze process. You can also open it directly by clicking the exclamation point icon (on the toolbar above the Navigator area).
For example, the method applicationDidFinishLaunching that you wrote earlier contains an unused variable (myUnusedMessage). This is highlighted with a yellow exclamation point in the Issue Navigator (Unused Entity Issue), as shown in Figure 6.20.
FIGURE 6.20 Use the Issue Navigator to browse all your project’s potential problems.
Jumping to an Error
To jump to an error in your code, just click it in the Issue Navigator. The corresponding code is opened, and the error message is visible directly after the line that caused the problem. To remove the warning from the sample method, just delete the line NSTextField *myUnusedMessage; to empty the Issue Navigator.
Fixing Errors to Find Others
With the warning message still visible in the applicationDidFinishLaunching method (add the code line back in, if you need to), try adding a line of complete garbage into the code. Pay attention to what happens when you click off of the line.
What you will see is that the new code is flagged as an error (red stop sign), but the original warning has disappeared. This brings up an important point: Sometimes not all errors or warnings are detected and displayed in the Issue Navigator or in a source file. You might find, after fixing a line or two, that new and previously undetected errors appear. Conversely, you’ll also occasionally see false errors that disappear when you correct others.