Skip to content

Both copy text to your clipboard — Build with AI copies a setup prompt to paste into Claude Code, Cursor, Codex or Copilot; Copy page as Markdown copies this page to paste into a chat. How it works

Prerequisite

For all of our examples, you will need:

  • an API key,
  • knowledge in Swift/iOS development,
  • one style (default)

Get the library

Use MapMetrics-SDK. The MapMetrics-iOS pod is abandoned.

This page used to install MapMetrics-iOS ~> 0.0.3. Do not use it. That pod stopped at 0.0.3, and its repository has no release newer than 1.0.0.

The current iOS SDK is MapMetrics-SDK, at 2.0.1.

This is a billing difference, not a version-number preference. Up to and including 2.0.0, the SDK sent its opening style-and-tile wave before the async map-session create landed, so those requests carried only the style token and were billed once per tile instead of once per map load — 8+ units on a cold start. Nothing looks wrong when that happens: the map renders correctly and the cost is silent. 2.0.1 is a floor, not a preference.

Installation (CocoaPods)

Add this to your Podfile:

ruby
target 'YourApp' do
  pod 'MapMetrics-SDK', '~> 2.0.1'
end

Run:

bash
pod install

Required Build Settings (Sandbox Fix)

To prevent rsync.samba deny(1) errors, users must add these settings:

Option A: Automatic Fix (via Podfile)

Add to your Podfile:

ruby
post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      # Disable sandbox restrictions
      config.build_settings['ENABLE_USER_SCRIPT_SANDBOXING'] = 'NO'
    end
  end
end

Then run:

bash
pod install

Option B: Manual Fix (Xcode Settings)

  1. Open your project in Xcode.
  2. Go to Target → Build Settings.
  3. Search for ENABLE_USER_SCRIPT_SANDBOXING.
  4. Set to NO for all configurations (Debug/Release).

Verify Installation

Import in your code:

swift
import MapMetrics

Clean Build (if issues persist):

bash
rm -rf ~/Library/Developer/Xcode/DerivedData/*

Troubleshooting

IssueSolution
Sandbox deny(1) errorsEnsure ENABLE_USER_SCRIPT_SANDBOXING=NO is set.
pod install failsDelete Pods/ and Podfile.lock, then retry.
Version conflictsRun pod update MapMetrics.

Example Podfile (Complete)

ruby
platform :ios, '12.0'

target 'YourApp' do
  use_frameworks!
  pod 'MapMetrics-SDK', '~> 2.0.1'

  post_install do |installer|
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['ENABLE_USER_SCRIPT_SANDBOXING'] = 'NO'
      end
    end
  end
end

Example Usage

Here's how to integrate MapMetrics into your project:

swift
class ViewController: UIViewController, MLNMapViewDelegate {
    var mapView: MLNMapView!

    override func viewDidLoad() {
        super.viewDidLoad()

        mapView = MLNMapView(
            frame: view.bounds,
            styleURL: URL(string: "https://gateway.mapmetrics-atlas.net/styles/?fileName=YOUR_STYLE_ID/YOUR_STYLE.json&token=YOUR_API_KEY")
        )
        mapView.delegate = self
        view.addSubview(mapView)
                mapView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
        mapView.delegate = self

        // This is a better starting position
        let center = CLLocationCoordinate2D(latitude: 20.0, longitude: 0.0) // More centered globally
        mapView.setCenter(center, zoomLevel: 2, animated: false) // Lower zoom to see more area
        view.addSubview(mapView)

    }
}