{infiniteZest}
// Articles. Tutorials. Utilities.
Home  |   Search  |   Login  
Categories Skip Navigation Links
New / All
AJAX
Apple
ASP.NET
.NET
Git
Google / Android
Python / IronPython
Miscellaneous
SQL Server
Starting with Xcode for iPhone development
Summary
This article discusses getting started with Xcode Tools for iPhone development. Talks about finding the Xcode in the directory structure. It goes through the basics of opening and running a sample iPhone application from Xcode.
 
Table of Contents

Location of Xcode

Figure 1. Location of Xcode, Interface Builder, Instruments, and Dashcode on the hard disk. By default these tools, documentation, libraries, etc. will be installed in the Developer folder.

Figure 2. The Dock with Xcode on it. It’s the one with hammer and blueprint signifying designing and building. Here, the icon next to it is Eclipse, another development tool for Java-Based programming.

Starting the Xcode

Figure 3. The Welcome window of Xcode. The iPhone Dev Center and Mac Dev Center provide links to videos, code, and reference material.

Figure 4. About Xcode Version 3.1.1. This can be used for developing applications for Mac OS X, iPhone, and iPod Touch.

Sample Application

Figure 5. Xcode Project Window. This project window has the groups and list of files on the left. On the right, you would find the details of the files and the source code editor at the bottom.

Running the application

Figure 6. The compiled application in the iPhone simulator. This application uses SQLite as the database in the back to store the information about books.

 
Article Series
Previous Article: This is the First Article of the Series
This article is part of the Series:
Article Series: Getting started with iPhone development
Next Article:
Test Your Knowledge: Starting with Xcode for iPhone development

Location of Xcode

After you have installed iPhone SDK, you would want to drag the Xcode application into the dock at the bottom of the screen (or whereever your dock might be). You can drag other iPhone application development tools (Interface Builder, Instruments, etc.) on to the dock as well, but you can start these programs from Xcode as well.

If you used the default locations to install iPhone SDK, the Xcode application (and Interface Builder, Instruments, and Dashcode) will be in the Developer\Applications folder.

Figure 1. Location of Xcode, Interface Builder, Instruments, and Dashcode on the hard disk. By default these tools, documentation, libraries, etc. will be installed in the Developer folder.

Figure 1. Location of Xcode, Interface Builder, Instruments, and Dashcode on the hard disk. By default these tools, documentation, libraries, etc. will be installed in the Developer folder.

As shown below, you can click on this Xcode icon from the dock, instead of trying to find it in the Finder each time you want to use it. Xcode is the tool that is used to build applications for Mac OS X and iPhone.

Figure 2. The Dock with Xcode on it. It’s the one with hammer and blueprint signifying designing and building. Here, the icon next to it is Eclipse, another development tool for Java-Based programming.

Figure 2. The Dock with Xcode on it. It’s the one with hammer and blueprint signifying designing and building. Here, the icon next to it is Eclipse, another development tool for Java-Based programming.

In the picture above, the Mac OS X dock contains Xcode as well as Eclipse. The iPhone application development can NOT be done with Eclipse. However, the application development for Google’s Android can be done with Eclipse. Mac OS X does not come pre-installed with Eclipse -- you would need to install it separately, if you need it. In any case, it has nothing to do with the iPhone application development.

So, if you want to develop applications for iPhone, you would use Xcode and the associated development tools. The Windows Mobile applications are developed with Visual Studio (using .Net Compact Framework or some other older technologies). Google’s Android platform uses Eclipse (and other Java development tools) for developing applications. And BREW is a C based (primarily) API for Qualcomm chips (mostly).

The mobile technologies and their phones:

  • iPhone: Xcode, Cocoa Touch, Objective-C
  • Windows Mobile: Visual Studio, .NET Compact Framework, C# (etc)
  • Google’s Android (G1 from T-Mobile): Eclipse, Android Library, Java
  • Qualcomm: Visual Studio, BREW, C/C++

Starting the Xcode

Clicking on the Xcode icon will bring up the welcome screen. The welcome screen of Xcode (here the version 3.1.1) has links to several videos and tutorials for developing applications for both Mac and iPhone.

If you are starting the Xcode for the first time or “Show at launch” checkbox is checked, you will see the “Welcome to Xcode” window.

Figure 3. The Welcome window of Xcode. The iPhone Dev Center and Mac Dev Center provide links to videos, code, and reference material.

Figure 3. The Welcome window of Xcode. The iPhone Dev Center and Mac Dev Center provide links to videos, code, and reference material.

As you can see in the figure above, the iPhone Dev Center has links to iPhone Tech Talk Videos, iPhone Sample Code, and iPhone Reference Library.

This application is being built from the Xcode Version 3.1.1. This version includes support for iPhone OS version 2.1 as well as iPhone OS version 2.0.

Figure 4. About Xcode Version 3.1.1. This can be used for developing applications for Mac OS X, iPhone, and iPod Touch.

Figure 4. About Xcode Version 3.1.1. This can be used for developing applications for Mac OS X, iPhone, and iPod Touch.

Sample Application

The following Xcode window has SqliteBooks project open. This is a sample project - with the project file named SqliteBooks.xcodeproj. Once you have installed this (and other) samples, you can double-click on the .xcodeproj file to open this project. Alternatively, you can use File-Open menu to go to the location of the .xcodeproj file and open it.

Figure 5. Xcode Project Window. This project window has the groups and list of files on the left. On the right, you would find the details of the files and the source code editor at the bottom.

Figure 5. Xcode Project Window. This project window has the groups and list of files on the left. On the right, you would find the details of the files and the source code editor at the bottom.

SQLite is a small but powerful open source database management system. You can see this library included as libsqlite3.0.dylib in the iPhone applications that use SQLite database to store its data (as opposed to some flat files). In the above diagram, you can see the file libsqlite3.0.dylib under the Frameworks folder in the Groups & Files window.

Running the application

Clicking on the ‘Build and Go’ button will build the source for the current project and show the application in iPhone simulator. The ‘Build and Go’ button on the toolbar is the simplest way to compile and run an application.

There are are several other ways of running an iPhone application - these are presented in the Run menu of Xcode. For example, you can the application with a Performance Measurement tool (Instruments) and start tracking things like activity on iPhone and memory leaks.

Figure 6. The compiled application in the iPhone simulator. This application uses SQLite as the database in the back to store the information about books.

Figure 6. The compiled application in the iPhone simulator. This application uses SQLite as the database in the back to store the information about books.

As you can see from the figure above, a table view (classes: UITableView / UIViewController or UITableViewController) is used to display the information. The ‘greater than’ sign next to each row is a table view cell accessory disclosure indicator (UITableViewCellAccessoryDisclosureIndicator), which when clicked will take you to next level in the hierarchy. At the top is the navigation bar (classes: UINavigationItem, UINavigationBar, and UINavigationController).

Take a Quick Quiz on this Article

1. What is the name of the tool that is used to develop applications for iPhone?



: Visual Studio is used to develop .Net applications
Question 1 of 6
Article Series
Previous Article: This is the First Article of the Series
This article is part of the Series:
Article Series: Getting started with iPhone development
Next Article:
Test Your Knowledge: Starting with Xcode for iPhone development
Bookmark and Share This

More Articles With Similar Tags
This is a test on the article that gives a quick overview of the development tools installed with iPhone SDK. These tools include Xcode, Interface Builder, Instruments, and iPhone Simulator. In the article, Dash Code, which is used to build web applications for iPhone is also introduced. GDB, the open source debugger, is discussed there as well.
icon-xcode-groups-files.jpg
This article discusses various parts of the Project window inside an Xcode project. It also gives a quick overview of the Groups and Files navigation window. The Run menu, the default toolbar, and the built-in source editor are also discussed.
This is a test on the article that discusses various parts of the Project window inside an Xcode project. It also gives a quick overview of the Groups and Files navigation window. The Run menu, the default toolbar, and the built-in source editor are also discussed.
This test is based on the article that explains the creation of an iPhone application. Article includes screenshots. It goes through choosing a template to base the iPhone application on and proceeds to explaining the basic contents of the project and compiling and running it.
These articles discuss getting started with iPhone application development. The development tools involved in creating iPhone applications (like Xcode, Interface Builder, Instruments, Dash Code, and iPhone Simulator) are introduced. Code for a simple first iPhone application is thoroughly discussed. Each lesson also comes with a quiz.
About  Contact  Privacy Policy  Site Map