Debugging your iOS applications is an essential part of your development effort. Xcode includes debugger utilities that help you trace and examine your code as you execute your application. The following sections describe some of the tips and tricks that you can employ when developing your iOS applications.
When you try to run your application, Xcode first tries to build the project before it can deploy the application onto the real device or Simulator. Any syntax errors that Xcode detects are immediately highlighted with the exclamation icons. Figure B-11 shows an Xcode-highlighted syntax error. The error within the code block is the missing brace symbol ([) for the [[UIAlertView alloc] statement.
You can also click the error icon to view the error and let Xcode suggest a fix (see Figure B-12).
Because Objective-C is a case-sensitive language, a mistake often made by beginners is mixing up the capitalization for some of the method names. Consider the block of code shown in Figure B-13.
Can you spot the error? Syntactically, the statement is correct. However, one of the parameters appears with the wrong case: initwithTitle: was misspelled — it should be initWithTitle: (note the capital “W”). When you compile the ...