Document Maps SDK for iOS Guides Set Up Your Project Core SDK Overview

Core SDK Overview

The AMAP Foundation SDK provides the core infrastructure and shared resources required by all other AMAP iOS SDKs, including the Map SDK, Location SDK, and Navigation SDK. You must integrate this SDK before using any other AMAP iOS SDK.

Before You Begin

1. SDK version requirements: Starting from iOS Map SDK V4.0.0, iOS Location SDK V2.0.0, and iOS Navigation SDK V2.0.0, all AMAP iOS SDKs require the Foundation SDK.

2. IDFA service: Starting from Foundation SDK V1.2.0, the SDK includes IDFA services. If your app does not use these services, see Submitting to the App Store.

3. API key configuration: For iOS Map SDK V4.0.0+, iOS Location SDK V2.0.0+, and iOS Navigation SDK V2.0.0+, you must import the Foundation SDK header and configure your API key as shown below.

Configure Your API Key

Import the header file and set your API key before using any AMAP services.

#import <AMapFoundationKit/AMapFoundationKit.h>

[AMapServices sharedServices].apiKey = @"YOUR_API_KEY";

Configure Permissions

Network Permissions — HTTPS Support (Required)

App Transport Security (ATS) is a security feature introduced by Apple in iOS 9. When ATS is enabled, apps are forced to connect to network services over HTTPS instead of HTTP, protecting user data through encryption. While ATS is enabled by default, developers could previously disable it. However, starting January 1, 2017, Apple requires all apps submitted to the App Store to enforce ATS.

The following steps describe how to configure AMAP iOS SDKs to support Apple's ATS requirements.

Step 1: Update Your SDK

Update your SDK to the minimum version listed below.

Product

Minimum HTTPS Version

Release Date

iOS Foundation SDK

V1.3.2+ (Download)

2016-11-08

iOS 3D Map SDK

V4.5.0+ (Download)

2016-12-08

iOS Search SDK

V4.4.1+ (Download)

2016-12-02

iOS Location SDK

V2.2.0+ (Download)

2016-11-02

iOS Navigation SDK

V2.3.0+ (Download)

2016-10-13

Step 2: Enable HTTPS

Add the following code before configuring your API key to enable HTTPS.

[[AMapServices sharedServices] setEnableHTTPS:YES];

IDFA Permissions (Optional)

Foundation SDK V1.2.0 and later includes IDFA (Identifier for Advertisers). This may cause App Store review rejection. Read the following information carefully.

Purpose of IDFA

IDFA helps accurately identify users and allows us to track issues you may encounter while using the SDK, ensuring SDK stability. If your app integrates advertising services, we recommend using the standard version of our SDK.

If your app does not integrate any advertising services but needs to track ad-driven installs, you can still use the standard version. See the instructions below.

IDFA Options During App Store Review

When submitting your app to the App Store, you will see the following IDFA options:

App Store Connect IDFA declaration screen showing four advertising identifier options for an iOS app

Option Descriptions

1. Serve advertisements within the app: Select this if your app displays advertisements.

2. Attribute this app installation to a previously served advertisement: Select this if you use third-party tools to track ad-driven installs, even if your app does not display ads.

3. Attribute an action taken within this app to a previously served advertisement: Select this if you use third-party tools to track user actions resulting from ads.

4. Limit Ad Tracking setting in iOS: This option is required whenever you access IDFA, regardless of your use case.

Resolving App Store Rejection

If your app displays ads but does not track ad-driven installs: Select options 1 and 4.

If your app does not display ads but accesses IDFA: Select options 2 and 4.

Download the IDFA-Free Version

If you prefer not to use the IDFA version, download the IDFA-free version.

Alternatively, use CocoaPods:

Edit your Podfile:

platform :ios, '9.0'
target 'YourProjectTarget' do
  pod 'AMapLocation-NO-IDFA' # IDFA-free Location SDK
end

Then run:

pod install

If the SDK cannot be updated, run pod repo update to refresh the pod repository.

WiFi Information Permissions (Optional)

On iOS 12+, you must enable the Access WiFi Information capability in Xcode to retrieve WiFi SSID. After enabling, Xcode automatically adds the required permission to your App ID and app entitlements.

Steps: Xcode → [Project Name] → Targets → [Target Name] → Capabilities → Access WiFi Information → ON

Xcode Capabilities tab with Access WiFi Information toggle enabled for an iOS AMAP SDK project

After completing these steps, your .entitlements file will contain the following key-value pair:

Xcode entitlements plist containing the com.apple.developer.networking.wifi-info key with a boolean true value

You can now retrieve the WiFi SSID on iOS 12+.

Region & Language Settings

/// Country code property
@property (nonatomic, copy) NSString *countryCode;
[AMapServices sharedServices].countryCode = @"SG";

// Language type
typedef NS_ENUM(int, AMapRegionLanguageType)
{
    /// Simplified Chinese
    AMapRegionLanguageTypeZhHans = 0,
    
    /// Traditional Chinese (Hong Kong)
    AMapRegionLanguageTypeZhHantHk,
    
    /// English
    AMapRegionLanguageTypeEn,
    
    /// Spanish
    AMapRegionLanguageTypeEs,
    
    /// Portuguese
    AMapRegionLanguageTypePt,
    
    /// French
    AMapRegionLanguageTypeFr,
    
    /// German
    AMapRegionLanguageTypeDe,
    
    /// Thai
    AMapRegionLanguageTypeTh,
    
    /// Japanese
    AMapRegionLanguageTypeJa,
    
    /// Korean
    AMapRegionLanguageTypeKo,
    
    /// Arabic
    AMapRegionLanguageTypeAr,
    
    /// Turkish
    AMapRegionLanguageTypeTr,
    
    /// Hebrew
    AMapRegionLanguageTypeHe,
    
    /// Italian
    AMapRegionLanguageTypeIt,
    
    /// Russian
    AMapRegionLanguageTypeRu,
    
    /// Malay
    AMapRegionLanguageTypeMs,
    
    /// Indonesian
    AMapRegionLanguageTypeId,
    
    /// Vietnamese
    AMapRegionLanguageTypeVi,
    
    /// Polish
    AMapRegionLanguageTypePl,
    
    /// Czech
    AMapRegionLanguageTypeCs,
    
    /// Ukrainian
    AMapRegionLanguageTypeUk,
    
    /// Azerbaijani
    AMapRegionLanguageTypeAz,
    
    /// Max Value Marker
    AMapRegionLanguageTypeMax
};

[AMapServices sharedServices].regionLanguageType = AMapRegionLanguageTypeEn;

// RTL Status:
// 0: Not set, follows the global setting
// 1: Disabled
// 2: Force enabled
typedef NS_ENUM(NSInteger, AMapAttributeRTLState)
{
    AMapAttributeRTLStateDefault = 0,   // Not set, follows the global setting
    AMapAttributeRTLStateDisabled,      // Disabled
    AMapAttributeRTLStateEnabled        // Force enabled
};
[AMapServices sharedServices].enableRTLLayout = AMapAttributeRTLStateEnabled;