HERE iOS SDK Developer's Guide

Creating a Simple Application Using the HERE SDK

This guide provides instructions on creating a simple HERE iOS SDK application to render a map on an iOS device. Users are able to navigate the map by way of touch gestures such as panning, rotating, tilting, and pinching. The contents of this guide apply to Xcode 8.3 and the iOS 10 SDK.

Note: The HERE iOS SDK is now distributed as a dynamic framework instead of a static library. Please review the following steps and update your Xcode project configuration if you are upgrading from an older versions of the HERE SDK. Also, ensure you first remove the old NMAKit.framework, NMABundle.bundle, and linked libraries from your Xcode project, before you add the new dynamic framework.

Sample Project in the HERE iOS SDK

A copy of the Xcode project described in this tutorial is available in the sample-apps folder in your HERE iOS SDK package. To run the project, double-click on HelloMap.xcodeproj and follow the instructions in the README.txt file.

Acquire HERE SDK Credentials

Before developing a new HERE SDK application, you need to acquire a set of credentials by registering your application on http://developer.here.com. Each application requires a unique set of credentials. When you register your app, the registered bundle identifier must match the bundle identifier in your project.

Create a New Single View Application

  1. From XCode menu, select File > New > Project to open the New project dialog (or press Shift + Command + N).
  2. Select iOS > Application > Single View Application as the application type you want to create. Press Next.
  3. In the next dialog, enter your Product Name (such as HelloMap) and Organization Identifier (such as edu.self). The resulting Bundle Identifier must be the same as you have registered on developer.here.com.
  4. Next, choose "Objective-C" under Language, then choose "iPhone" under Devices, then click Next. Navigate to the directory where you want your project to be stored and then select Create.
  5. The next step is to configure this project to use the HERE SDK.

Configure the Application

  1. Extract the HERE iOS SDK archive to somewhere in your local file system.
  2. Add the NMAKit dynamic framework to your Xcode project. Click on your app target and choose the "General" tab. Find the section called "Embedded Binaries", click the plus (+) sign, and then click the "Add Other" button. From the file dialog box, select the "NMAKit.framework" folder. Ensure that the "Copy items if needed" and "Create folder reference" options are selected, then click Finish.
    Figure 1. Adding NMAKit.framework
  3. Ensure that NMAKit.framework appears in the "Embedded Binaries" and the "Linked Frameworks and Libraries" sections.
    Figure 2. Added Embedded Binaries
  4. Next, ensure that modules are enabled. Click on the "Build Settings" tab and navigate to the "Apple LLVM 7.1 - Language" - Modules section. Ensure that the "Enable Modules (C and Objective-C)" has the value "YES".
    Figure 3. Enable Modules
  5. Run the application. From the Xcode menu bar, select Product > Run. Ensure that the project runs in the iOS Simulator without errors.
  6. The HERE iOS SDK is now ready for use in your Xcode project. Now that you have your project configured to work with the HERE SDK, try extending the sample application to render a map.

Create the Map View

In this section, we utilize the NMAMapView and NMAGeoCoordinates classes to render a Map.

  1. Create an NMAMapView.

    1. Select Main.storyboard in the navigator, then open the Utilities view by pressing the key combination Command + Option + Control + 3. Drag and drop a View object from the Object Library onto the View Controller. If necessary, resize the View so it takes up the entire viewable area.
    2. In the Interface Builder, click on the created View and then open the Identity Inspector in the Utilities view by pressing the key combination Command + Option + 3. Change the class value from UIView to NMAMapView and press return. In the Document Outline, you should see that the name of the View has changed from to View to Map View.
    Figure 4. MapView
  2. Create an outlet to NMAMapView in ViewController.

    1. Select Main.storyboard in the navigator.
    2. Press Command + Option + Return to open the Assistant Editor. It should show ViewController.m.
    3. Add the following import statement to the top of this file:
      @import NMAKit;
    4. Hold the Control key on the keyboard and click to drag from the Map View to the interface block in ViewController.m. You should see a blue line and tooltip which says "Insert Outlet or Outlet Connection". Release the mouse button and a dialog appears, allowing you to create an outlet.
    5. Name the outlet mapView, keep the other default options and then select Connect.

    Figure 5. Create an Outlet
  3. Now an outlet to NMAMapView is set. The modified file should be as follows:

    #import "HelloMapViewController.h"
    
    @import NMAKit;
    
    @interface HelloMapViewController ()
    @property (weak, nonatomic) IBOutlet NMAMapView *mapView;
    @end
    
    @implementation HelloMapViewController
    
    - (void)viewDidLoad
    {
      [super viewDidLoad];
    }
    
    - (void)didReceiveMemoryWarning
    {
      [super didReceiveMemoryWarning];
    }
    
    @end
  4. Implement NMAMapView setup and lifecycle code by modifying the viewDidLoad method as shown:
    - (void)viewDidLoad
    {
      [super viewDidLoad];
      //set geo center
      NMAGeoCoordinates *geoCoordCenter =
        [[NMAGeoCoordinates alloc] initWithLatitude:49.260327 longitude:-123.115025];
      [self.mapView setGeoCenter:geoCoordCenter withAnimation:NMAMapAnimationNone];
      self.mapView.copyrightLogoPosition = NMALayoutPositionBottomCenter;
    
      //set zoom level
      self.mapView.zoomLevel = 13.2;
    }
  5. Add your HERE application credentials.
    1. Open AppDelegate.m and import NMAKit by adding the following import statement to the top of the file.
      @import NMAKit;
    2. Add the following in the didFinishLaunchingWithOptions method, replacing YOUR_APP_ID, YOUR_APP_CODE and YOUR_LICENSE_KEY with the credentials that you received from http://developer.here.com.
      [NMAApplicationContext setAppId:@"YOUR_APP_ID"
                  appCode:@"YOUR_APP_CODE"
                  licenseKey:@"YOUR_LICENSE_KEY"];
  6. Build and run the application. If the build is successful, you now have an application that displays a map similar to the following screenshot and allows you to manipulate it using gestures.

    Figure 6. Running the App Running the App

You cannot use this account to purchase a commercial plan on Developer Portal, as it is already associated to plans with different payment methods.

To purchase a commercial plan on Developer Portal, please register for or sign in with a different HERE Account.

Something took longer than expected.

The project should be available soon under your projects page.

Sorry, our services are not available in this region.

Something seems to have gone wrong. Please try again later.

We've detected that your account is set to Australian Dollars (AUD).
Unfortunately, we do not offer checkouts in AUD anymore.
You can continue using your current plan as normal, but to subscribe to one of our new plans,
please register for a new HERE account or contact us for billing questions on selfservesupport@here.com.