Creating a New Xcode Project

XCode is the defacto Integrated Development Environment (IDE) for developing iOS applications. You can download XCode separately or as part of the iOS SDK from Apple's iOS Dev Center.

When you create a new iOS project in Xcode, you can start by using one of the default iOS application project templates or you can choose from one of the ArcGIS project templates that have been provided for you when you installed the ArcGIS API for iOS.

Choose Project

Using ArcGIS Project Templates

The ArcGIS project templates are a great starting point for developing your iOS applications. They include a number of project settings required for developing with the ArcGIS API for iOS.

To get started, first select ArcGIS from the list of User Templates, then select the appropriate ArcGIS project template and click the Choose... button.

Choose ArcGIS Template

Once you click Choose, you are ready to start developing your iOS application.

Each of the ArcGIS templates configure a number of settings within your Xcode project that you would have to otherwise set up yourself. You would need to manually configure these settings if you were to use one of XCode's default iOS project templates (see below for those details).

If you are just getting started, you may want to walk through the My First iPhone Application.

Using XCode's Default Project Templates

If you do not wish to use the ArcGIS project templates, you can use one of the default iOS application project templates and then configure it to use the ArcGIS API. This may be necessary, for example, if you have already created your own iOS application and wish to add ArcGIS capabilities to it. The following steps describe how to configure your project settings :

Add ArcGIS library

To add the ArcGIS library to your project, choose the the Edit Active Target <Project_Name> options from the Project menu. This should open the Target Info window. From within the Target Info window, select the General tab. Press the + button under the Linked Librariessection to add the ArcGIS library.

The ArcGIS library is not in the default list of iOS libraries so you will need to click the Add Other... button to browse for the library. The library is typically located at ${HOME} /Library/SDKs/ArcGIS/iOS.sdk/usr/local/lib if you installed the ArcGIS API in the default location.

Add ArcGIS libraries

Modify the build path

Adding the ArcGIS library to your project references is not enough. You also need to provide the path to this library so that your project can be built correctly.

Open the Target Info window once again except this time select the Build tab. Scroll down to the Library Search Paths, double click on it, and use the plus button to add the following entry:

$(HOME)/Library/SDKs/ArcGIS/iOS.sdk/usr/local/lib

Modify build flags

ArcGIS library is an Objective-C library. You need to add some build flags to your project to ensure that the Objective-C categories defined in the library are loaded correctly.

To add the flags, open the Target Info window, Click on the Build tab and in the Search bar type "Other Linker Flags" to quickly find the linker flag properties. Once located, double-click on it to change its properties.

Press the plus button to add the following linker flags: -all_load and -ObjC. Click Ok when you are done.

NoteNote:

Without these flags, your application may crash while trying to use classes from the ArcGIS API.

Add ArcGIS header files to the search path

From within the Target Info windo, you will need to add the header files to the search path to support the ArcGIS library.

Click on the Build tab and in the Search bar type "User Header Search Paths". Once located, double-click on it to change its properties.

Press the plus button to add the following path:

$(HOME)/Library/SDKs/ArcGIS/iOS.sdk/usr/local/include/**

Add dependent libraries

Finally, add additional libraries that the ArcGIS library depends upon. These are listed below

  • CoreGraphics.framework
  • CoreLocation.framework
  • Foundation.framework
  • QuartzCore.framework
  • UIKit.framework

To add each dependent library, click the Edit Active Target <Project_Name> option from the Project menu. This should open the Target Info window. From within the Target Info window, select the General tab. Press the + button under the Linked Librariessection to add each dependency.

Add Dependent Libraries


3/23/2011