MapQuest Maps SDK for iOS

iPhones with MapQuest Maps

The MapQuest Maps SDK is a native library for interactive maps and traffic – built on vector maps and powered by the MapQuest tileset and traffic data.

Features

  • Multiple Sample applications including a Maps Test app or the MapQuest NavSDK Sample app – provided as a reference design for customers, and to show off best UX practices for a navigation experience.
  • Built-in Styles Standard street, Night, and Satellite map styles included - along with the new MapQuest style!
  • Customizable styles on top of the MapQuest style gives you unparalleled flexibility
  • Label collision detection ensures that your annotation labels don't colide and look better on the map New in 4.0
  • Annotations, Overlays, Images, Polyline/Polygon add annotations, overlays, polylines, polygons on your map. Use bubble annotations when an annotation is tapped.
  • Tracking Modes to automatically follow a user, for example using the NavSDK
  • Layers provides support for multiple ways to display data on top of your map New in 4.0
  • Runtime Styling gives you the ability to dynamically change the look and feel of your map in real time New in 4.0
  • Faster and more efficient now more efficient in memory usage along with a better user experience New in 4.0

Complementary APIs

The following APIs are often used with the Navigation SDK, but note these do incur a transaction cost to use:

  • Navigation SDK : full documentation available here
  • Geocoding APIs : full documentation available here
  • Search / Search Ahead APIs : full documentation available here

MapQuest Key

In order to use MapQuest APIs and SDKs you will need a MapQuest Key. We use this key to associate your requests to APIs with your account. You can find your existing Keys or create a new one at Applications page.

Sample Key Page

If you don't have a MapQuest Developer Account you can sign up for one. Sign Up Here.

Xcode and Apple’s iOS SDK

You can get these for free from the Mac App Store. Download Xcode Here

Apple Developer Account (optional)

You can use your personal devices or Xcode’s iOS Simulator for this guide without an Apple Developer Account. If you want to distribute your app to others, you’ll need to sign up and pay for an account. Sign Up Here

Setup Xcode

Project Setup

Open Xcode and go to File ‣ New ‣ Project to create a new project. Go to the iOS Application section and choose the Single View Application template.

Single Page Application

Set Product name to MyFirstMapQuestApp. Select Objective-C or Swift (whichever you prefer) as the language and iPhone as the device. For this guide, you’ll be developing an iPhone app. If you plan to support both iPhone and iPad, you can choose Universal as the device.

Application Options

Click Next to create a local folder that Xcode will store all your files in.

Downloading the MapQuest iOS SDK

Manual

Download the zipped SDK that contains the framework and a resource bundle that need to be included in the project

CocoaPods

Use the MapQuest iOS SDK within your own Xcode project using CocoaPods.

You need to include the following in the podfile:

source 'https://github.com/MapQuest/podspecs-ios.git'

pod 'MapQuestMaps', '4.0.0'

Using your MapQuest Key in the SDK

To use the MapQuest SDK in your app, you need to place your MapQuest Key inside the app’s Info.plist file:

  1. In the Project navigator (in the left sidebar), find your app’s Info.plist.
  2. Select the “Information Property List” row at the top, and go to Editor ‣ Add Item.
  3. In the new row that is inserted, set the Key to MQApplicationKey and set the Value to your Key.
Info.plist

You will also need to allow arbitrary loads in your app. You can do this by adding NSAppTransportSecurity to your Info.plist with NSAllowsArbitraryLoads set to true. We are actively working on resolving this requirement.

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

Adding a map using storyboards

Use the Interface Builder storyboard. Select the existing view from your view controller, then in the Identity inspector tab in the right sidebar, change the class to MQMapView. This adds the MapQuest map into the view controller.

Storyboard

You must update your view controller to import the Mapbox module and define the mapView variable.

import UIKit
import Mapbox
class ViewController: UIViewController {
  @IBOutlet var mapView: MQMapView!

  override func viewDidLoad() {
      super.viewDidLoad()
      mapView?.mapType = .normal // Do any additional setup after loading the view, typically from a nib.
   }
}

Examples

We have provided a variety of examples with how to use the Maps SDK from how to load a basic map view to runtime styling and user location follow mode. Start off with the basic MapQuest Map View.

Supporting Documentation