Learn Objective-C on the Mac - Mark Dalrymple [14]
Sharing Your Creation With the World
Quit Hello World. There’s one last thing we want to show you. You’ve now created your application, but where is it? What if you want to give (or sell) your application to others so they can run it on their machine?
First of all, you need to compile your application a little differently if you want to let others use it. Back in Xcode, if you look in the upper left part of the project window (Figure 2-24), you’ll see a large drop-down menu labeled Overview.
Figure 2-24. The left side of Xcode’s toolbar contains a multi-segmented drop-down menu that lets you specify the Mac OS X version to build for, build configuration, and target architecture.
This drop-down menu works differently from most other controls of its kind. Rather than letting you just pick one item from the menu, the Overview drop-down menu lets you make several choices that affect the compilation of your app, all from a single control. Figure 2-25 shows what you’ll see if you click on this control. There are several sections, and in each section you can select an item to change some aspect of the compilation process. In this case, the only things we can change are the Active Configuration and the Active Architecture.
Figure 2-25. Peering inside the Overview drop-down list
The second section of the drop-down menu is labeled Active Configuration, and that’s what you need to change so you can build a version of your application to distribute. By default, when you’re working in Xcode, you’re working in the debug configuration. When you build an application this way, Xcode builds it with extra stuff to make it easier to troubleshoot your application. These debug symbols allow you, for example, to examine and change the values of different variables while the program is running, or to step through your source code line-by-line using the debugger. In this chapter, we’re not doing anything that needs those symbols, but it’s generally good to develop using the debug configuration, switching out of it only to create a distributable version of your application.
An application built using the debug configuration is going to be a bit bigger and slower than one built for distribution. On the other hand, building for distribution is typically a bit slower than building the debug version, because the compiler is doing more work to try to optimize the resulting code, and usually building for multiple platforms (Intel and
PowerPC) as well. In any case, in order to distribute your application, you have to switch to the other configuration, called the release configuration. Do that now.
Once you’ve selected that, select Build from the Build menu or press ⌘B to build your application. Once Xcode reports that it has successfully built the project, right-click on the top-most item in the Groups & File’s pane. The item is named Hello World and represents your project.
NOTE: In several places in the book, we will tell you to right-click on something. If you have an older one-button mouse, you can achieve the same thing by holding down the control key on your keyboard then clicking with the mouse’s one button.
Select Reveal in Finder from the contextual menu that appears. This will take you to the Hello World project folder in the Finder. Inside the window that opens up, you’ll find another folder called build. Inside build, you’ll find three more folders. The folder called Hello World.build holds temporary files that Xcode generates during the