We have mastered some basic knowledge. Before you start programming, You need to configure the development environment:
2.1 IOS Configuration
1) Mac computer (both MacBook Air/Pro, Mac Mini and IMAC );
2) Snow Leopard (minor version 10.6.2 or later), Lion (minor version 10.7 or later), or mountain lion Operating System
3) download and install the xcode development tool (xcode is an integrated development environment of Apple ):
A. The latest xcode 4.5 version (With iOS 6 SDK, the installation package is about 1.56 GB );
B. Other xcode 4.x versions (With iOS 5 SDK, the installation package is about 1.4 GB ).
* Xcode can be downloaded from the apple Developer Center for free: https://developer.apple.com/downloads/index.action
4) The developer account of apple is 99 RMB/year. If there is no visa, or students can consider using the PJ account for development, they must sign the application when publishing the application.
* If you do not have a Mac, you can also consider using a virtual machine. We have seen someone using vmware workstation 8. X to create snow leopard.
2.2 ArcGIS for iOS Configuration
With the iOS development environment, we also need to configure ArcGIS for iOS:
1) download and install ArcGIS runtime SDK for iOS v2.3.2;
* The ArcGIS runtime SDK for iOS installation package (*. PKG file) can be downloaded from the ESRI resource center for free:
Http://www.esri.com/apps/products/download/index.cfm? Fuseaction = download. All # arcgis_runtime_sdk_for_ios
2) check whether the SDK file is successfully installed. The default installation path is$ {Home}/library/sdks/ArcGIS/Including the ArcGIS Framework library and a mapviewdemo sample project. The Framework library directory contains the library files, resource packages, and language packs.
* If you want to upgrade and install, we recommend that you uninstall the old version first:
$ {Home}/library/applicationsupport/agsiossdk/uninstallagsiossdk
* If you cannot see the library directory in the finder, you can run the following command on the terminal:
Chflagsnohidden ~ /Library/
3) if the installation fails, the log will be written/Var/log/install. LogThe common cause is that the user permission is insufficient or the installation package is damaged. You need to upgrade to the Administrator permission and re-download the installation package.
2.3 xcode project configuration
Start xcode, create an iOS project, select single view application (single view template), and enter the project name and organization information. "Class prefix" is the class prefix name, "device": select the corresponding device, Hook "Use
The automatic reference counting option simplifies manual memory management, "Use storyboard", and "includeunit
"Tests" is not selected for the moment to avoid increasing the beginner's entry burden.
Figure 2-1 create a project
After selecting the Save path of the project, "helloworld map" is created successfully. xcode is quite useful, as shown in the following figure: menu and toolbar, project Directory window, and content editing window.
Menu and toolbar, including general project management, file editing, and view control. The most common menu and toolbar are added by default: run/stop, target selection, Status Bar, and device management items.
The project Directory window contains the file directory view, logic hierarchical view, search view, message view, debugging view, breakpoint view, and log view, the file directory view can manage folders, codes, interfaces, and reference libraries.
In the content editing window, after selecting an object in the file directory view, the content window further expands the content of the object. The code editing and program interface layout are all carried out here.
* This section only describes the general functions of xcode. For more details, see its help documentation or other iOS development introductory materials.
Figure 2-2 xcode function layout
Step 1: Add ArcGIS framework reference, select the project targets, search for "framework search paths" in "build setting", double-click to edit and add:$ (Home)/library/sdks/ArcGIS /**.
Figure 2-3 add ArcGIS framework reference
Step 2: add other references. Because the ArcGIS framework also references many basic IOS frameworks, you need to add the following references in "link binary with libraries" of "build phases:
- Uikit. Framework
- Foundation. Framework
- CoreGraphics. Framework
- Corelocation. Framework
- Quartzcore. Framework
- Coretext. Framework (New in v1.8)
- Libstdc ++. dylib (introduced in v1.8)
- Mediaplayer. Framework (introduced in V2.0)
- Mobilecoreservices. Framework (introduced in V2.0)
- Libz. dylib (introduced in V2.1)
- Security. Framework (New in V2.1)
Figure 2-4 add other references
* The Mac commond key function is similar to the PC ctrl key. You can press it to select multiple.
Step 3: Modify the compilation tag. To run the ArcGIS framework normally, you also need to add the compilation tag. Search "Other linker flags" in "build setting" and double-click to edit and add:-All_load-objc-framework ArcGIS.
Figure 2-5 modify the compilation tag
Step 4: Add a resource package. The ArcGIS framework provides commonly used images, views, and Language Pack resources, which are packaged in "ArcGIS. Bundle". The file is located:$ {Home}/library/sdks/ArcGIS. Framework/versions/current/Resources.
* Optional.
Step 5: Add a map, including creating a map container mapview and map controller. The details are described in the next section.
* If you get bored with the above configuration process, you will ask: Why don't you directly provide an ArcGIS Project template? This is a good question. The official explanation is that Apple does not allow third-party templates to be integrated in xcode. We can use the defaultMapviewdemo sample project, where the map has been configured and added. The project is located:
$ {Home}/library/sdks/ArcGIS/samples/mapviewdemo
Also: Recommended blog posts:
ArcGIS
Runtime SDK for iOS development series tutorials (1) -- preparations before development: http://www.cnblogs.com/esrichina/archive/2012/09/01/2666398.htmlArcGIS
Runtime SDK for iOS development series (3) -- objective-C syntax basics: http://www.cnblogs.com/esrichina/archive/2012/10/25/2671149.html