Getting Started with the ArcGIS iOS SDK

If you want to edit spatial data in the field, one of the best things going is Collector for ArcGIS. If you want to accomodate custom workflows however, right now the only way to facilitate this is to build the application from scratch using XCode and the ArcGIS for iOS SDK. With the release of iOS 8 and the Swift programming language, I decided it was high time to at least try to build iOS mapping applications to use on my iPhone and iPad. Although not outrageously difficult to get started, the instructions on the Getting Started leave a small gap, one proving perplexing for quite some time. Hopefully this posting makes your life a little easier when delving into this world for the first time.

Initially looking at the directions on the Getting Started page, the instructions first list four steps for using CocoaPods and another two pages of scrolling for not using CocoaPods.

Althouhg I had never heard of CocoaPods before, this was not altogether surprising. My experience with XCode amounts to something just shy of two days. It took another day of interspersed with other meetings and projects to sort this out. Here is the step by step directions if you are stumbling on this as well.

  1. Download and install the ArcGIS iOS SDK from Esri (do this once)
    This is pretty boilerplate stuff. Click the download link and follow the dialog prompts.

  2. Download and install CocoaPods in Terminal
    Go ahead and open up Terminal. If you are not familiar with Terminal, now is as good of a time as any. You are, after all, trying to start coding. The command line is your friend. Install CocoaPods from the terminal.

    sudo gem install cocoapods
    
  3. Start a new project with XCode
    Whether using the initial spash screen, or going to File > New > Project...either way, get yourself a fresh new project to work with.

  4. Close your new project and close XCode
    This begins the part I was missing. Yes, shut down XCode. There very well may be a better way to do it, but this is how I got all this working.

  5. Open Terminal, navigate to the directory and create a Podfile
    In Terminal, you can change to the directory where your project lives, and a handy tip is if you saved the project in your profile, such as in Documents as mySweetMap, you can get to this location with the use of a tilde and the cd command.

    cd ~/Documents/mySweetMap
    

    Now, once in the right directory, create a file for the Podfile configuration using the touch command.

    touch Podfile
    

    This Podfile needs some obligatory information about the build version and what packages you want. First open up the file in TextEditor.

    open Podfile
    

    If using iOS 8.1 with the ArcGIS iOS SDK, copy and paste the follwoing into the Podfile.

    source 'https://github.com/CocoaPods/Specs.git'
    platform :ios, '8.1'
    
    
    pod 'ArcGIS-Runtime-SDK-iOS'
    

    Save your podfile and close up TextEditor

  6. Load up the Pods
    Jump back to the terminal and load up the Pods.

    pod install
    

    A whole bunch of text will flow up through the Terminal. Wait for it to finish. Depending on the speed of your internet connection, this could take a few seconds or you might need to go do something else for a while.

  7. Open up the workspace file
    This was the part really getting me. Apparenlty XCode does not load the installed Pods correctly if you open from the project file. This is what XCode typically does. From the command line, open up your project using the workspace file.

    open mySweetMap.xcworkspace
    

    From this point forward. Always open your projec this way and XCode (along with you) will be much happier working with the ArcGIS iOS SDK.

From here you can dive into the first tutorial and it will work! When I finally figured this out and saw a map in my running application, I did a sweet happy dance. Feel free to do the same.