Document Maps SDK for iOS Guides Map Add a Map

Add a Map

Before You Begin

1. If you haven't already integrated the 3D Map SDK into your project, refer to theManual Deployment or CocoaPods Deployment guide.

2. If your app requires the SDK to use HTTPS for network requests, see the HTTPS Configuration section.

Configure the Header Files

Add the following header imports to your ViewController.h file. For Swift projects, import these headers in your bridging header file instead:

#import <MAMapKit/MAMapKit.h>
#import <AMapFoundationKit/AMapFoundationKit.h>

Initialize the Map Object

Add the following code to your MapTypeViewController.m file to create and display a MAMapView instance:

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Additional setup after loading the view from a nib.

    /// Required for SDK v4.5.0 and above. For earlier versions, configure info.plist manually.
    [AMapServices sharedServices].enableHTTPS = YES;
    
    /// Initialize the map view
    MAMapView *_mapView = [[MAMapView alloc] initWithFrame:self.view.bounds];
    
    /// Add the map view to the current view
    [self.view addSubview:_mapView];
}

Enable the World Map

The World Map is supported starting from iOS 3D Map V10.1.200. To enable it, use the following property:

@property (nonatomic, assign, class) BOOL loadWorldVectorMap

Switch to English Map

To switch the map display language to English, set the regionLanguageType property:

MAMapView.regionLanguageType = 2;

Language Code Reference

The following table lists the available language codes:

Code

Language

0

Simplified Chinese

1

Traditional Chinese

2

English

3

Spanish

4

Portuguese

5

French

6

German

7

Thai

8

Japanese

9

Korean

10

Turkish

11

Hebrew

12

Italian

13

Russian

14

Malay

15

Indonesian

16

Vietnamese

Build and run the project. The result should look like this:

iOS Maps SDK example showing a basic map displayed in an iOS application