Build and Run on the Simulator

Now you are ready to build the application and run it on the simulator. You can click the iTunes-esque play button in the top left corner of the workspace, but you’ll be doing this often enough that it’s easier to remember and use the keyboard shortcut, Command-R. Either way, make sure that the Simulator option is selected in the pop-up menu next to the play button (Figure 1.20).

Figure 1.20  Running the application

Running the application

If there are any errors or warnings, you can view them in the issue navigator by selecting the Running the application icon in the navigator selector (Figure 1.21). The keyboard shortcut for the issue navigator is Command-4. In fact, the shortcut for any navigator is Command plus the navigator’s position in the selector. For example, the project navigator is Command-1.

Figure 1.21  Issue navigator with errors and warnings

Issue navigator with errors and warnings

You can click on any issue in the issue navigator, and it will take you to the source file and the line of code where the issue occurred. Find and fix any issues you have (i.e., code typos!) by comparing your code with the book’s and then build the application again. Repeat this process until your application compiles.

Once your application has compiled, it will launch in the iOS simulator. But before you play with it, you’ll want the console visible so that you can see the output of the log statements. To see the console, reveal the debug area by clicking the middle button in the Issue navigator with errors and warnings group at the top right of the workspace window.

The console is on the righthand side of the debug area, and the variables view is on the left. You can toggle these panels on and off with the Issue navigator with errors and warnings control in the top-right corner of the debug area. You can also resize the area and its panels by dragging their frames (Figure 1.22).

Figure 1.22  Debug area expanded

Debug area expanded

Play around with the Quiz application. You should be able to tap the Show Question button and see a new question in the top label; tapping Show Answer should show the right answer. If your application isn’t working as expected, double-check your connections in MainWindow.xib and check the console output when you tap the buttons.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.172.130