Configuring an Xcode Project

Xcode is the defacto Integrated Development Environment (IDE) for developing iOS applications. Xcode can be downloaded separately or as part of the iOS SDK from Apple's iOS Dev Center. At the time of writing this document, Xcode 4.3.1 was the most recent version available and supported.

You can create a new project using one of the built-in iOS project templates and then configure it to begin development with ArcGIS Runtime SDK for iOS.The following steps describe the project settings that need to be configured.

NoteNote:

Some of you may notice that ArcGIS specific Xcode project templates are no longer available. This is because 3rd party project templates are not officially supported by Xcode.

1. Add ArcGIS to the Framework Search Paths

To add the ArcGIS framework to your project, select the project node in the left Navigator pane, select a target node, and choose the Build Settings tab.

Under the tab, type "Framework Search Paths" in the Search bar to quickly find the Framework Search Paths setting. Double click in the empty space under the target column, and use the plus button to add the following entry:

$(HOME)/Library/SDKs/ArcGIS/**

2. Add dependent libraries

The ArcGIS framework in turn depends upon the following frameworks and libraries which need to be added to your project's settings.

  • CoreGraphics.framework
  • CoreLocation.framework
  • Foundation.framework
  • QuartzCore.framework
  • UIKit.framework
  • CoreText.framework (dependency introduced at v1.8)
  • libstdc++.dylib (dependency introduced at v1.8)
  • MediaPlayer.framework (dependency introduced at v2.0)
  • MobileCoreServices.framework (dependency introduced at v2.0)
  • libz.dylib (dependency introduced at v2.1)
  • Security.framework (dependency introduced at v2.1)

Select the Build Phases tab. Under the Link Binary with Libraries section, click on the + button, select and add each dependency.

3. Modify build flags

You need to add some build flags to your project to ensure that the ArcGIS framework is loaded correctly.

NoteNote:

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

Under the Build Settings tab, type "Other Linker Flags" in the Search bar to quickly find the Other Linker Flags setting. Single click in the empty space under the target column. The empty space should turn into a textbox. Enter the following text : -all_load -ObjC -framework ArcGIS. Click anywhere outside the textbox to finish.

4. Add Resource Bundle

API resources such as images for the Esri and Bing logo, GPS location, etc are consolidated into an ArcGIS.bundle file. This bundle is typically installed under ${HOME}/Library/SDKs/ArcGIS/ArcGIS.framework/Versions/Current/Resources if you picked the default location while installing the ArcGIS Runtime SDK for iOS. You need to manually add this bundle to your project as described below.

Go to the XCode application's File menu, select the Add Files to <project> item, browse to the location ${HOME}/Library/SDKs/ArcGIS/ArcGIS.framework/Versions/Current/Resources, select the ArcGIS.bundle file, and click Add.

NoteNote:

The ${HOME}/Library folder is hidden by default in Mac OS X Lion. You can issue the command chflags nohidden ~/Library/ in the terminal to unhide it. This will enable you to browse to it using the Add Files to <project> dialog window.

To use custom images instead of the ones provided with bundle, add the custom images to your project making sure they have the same name as the images in the bundle. Images in your project will take precedence over those in the bundle.

Now that you have configured an Xcode project to begin development withArcGIS Runtime SDK for iOS, the next step is to create a map to display in your application.

NoteNote:

Configuring a new project as described above can be a little tedious, especially if you have to do it repeatedly. For your convenience, we provide a pre-configured project with the SDK installed under ${HOME}/Library/SDKs/ArcGIS/Samples/MapViewDemo. This sample is minimal and only contains the code to display a full screen map. You can easily make a copy of this project and then rename it to quickly begin development on a new application.

5/9/2012