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.
The following APIs are often used with the Navigation SDK, but note these do incur a transaction cost to use:
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.
If you don't have a MapQuest Developer Account you can sign up for one. Sign Up Here.
You can get these for free from the Mac App Store. Download Xcode Here
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
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.
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.
Click Next to create a local folder that Xcode will store all your files in.
Download the zipped SDK that contains the framework and a resource bundle that need to be included in the project
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'
source 'https://github.com/CocoaPods/Specs.git'
pod 'MapQuestMaps', '4.0.0'
To use the MapQuest SDK in your app, you need to place your MapQuest Key inside the app’s Info.plist file:
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>
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.
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.
}
}
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.