Skip To Content ArcGIS for Developers Sign In Dashboard


You will learn: how to build an app that loads a basemap and feature layers from a mobile map package file.

In this tutorial, you will use the ArcGIS Runtime SDK for iOS to open a mobile map package (.mmpk) on a device when offline. The package is created with ArcGIS Pro, ArcGIS Online or ArcGIS Enterprise using the ArcGIS REST API and loaded to your device as part of application deployment.

Before you begin

Make sure you have installed the latest version of Xcode.

Reuse the starter project

If you have completed the Create a starter app tutorial, then copy the project into a new empty folder. Otherwise, download and unzip the project solution. Open the .xcodeproj file in Xcode. Run and verify the map displays in the device simulator.

Prepare your data

Complete the tutorial Prepare your data for offline use. You will use the map package file created in that tutorial for the offline map data required in this tutorial.


Add your map package to your project

  1. In the Prepare your data for offline use data tutorial, you created a Mobile Map Package (.mmpk) file. Copy that file into your new Xcode project. If you did not complete that tutorial, you can download the tutorial's solution here.

Load and display the map package

  1. Open ViewController.swift in the Project Navigator. Add the mobile map package as a static property to ViewController. Create a AGSMobileMapPackage using the file referenced in the prior step.

    @IBOutlet weak var mapView: AGSMapView!
    /** ADD **/
    private let mobileMapPackage = AGSMobileMapPackage(name: "devlabs-package")
  2. Update the setupMap method to load the map package and check that it loads without error. Display the first map in the package in the map view.

    /** UPDATE **/
    private func setupMap() {
        mobileMapPackage.load { [weak self] (error) in
            guard let self = self else { return }
            if let error = error {
                print("Error loading the mobile map package: \(error.localizedDescription)")
            else if let map = self.mobileMapPackage.maps.first {
       = map
  3. Press Command-R to run the app in the iOS Simulator.

    (Note, as of 100.8 Runtime supports Metal. In order to run your app in a simulator you must meet some minimum requirements. You must be developing on macOS Catalina, using Xcode 11, and simulating iOS 13.)

Congratulations, you're done!

Your map should display with the view point centered on the Los Angeles area. Compare your solution with our completed solution project.