Measure logo
Getting Started

iOS

Integrate the Measure SDK in your iOS app.

Minimum requirements

NameVersion
Xcode15.0+
Minimum iOS Deployments12.0+
Swift Version5.10+

1. Get the credentials

Create a new app in the Apps section on the dashboard and copy its API URL and API Key.

2. Install the SDK

// In Package.swift
.package(url: "https://github.com/measure-sh/measure.git", branch: "ios-v0.12.1")
# In your Podfile
pod 'measure-sh'

MeasureSDK supports static linking only. If your Podfile uses use_frameworks!, install the cocoapods-pod-linkage plugin (gem install cocoapods-pod-linkage) and link measure-sh statically:

# In your Podfile
plugin 'cocoapods-pod-linkage'

target 'YourApp' do
  use_frameworks!
  pod 'measure-sh', :linkage => :static
end

3. Initialize the SDK

Initialize as early as possible to capture early crashes and accurate launch time metrics.

// In your AppDelegate's application(_:didFinishLaunchingWithOptions:)
import Measure

let clientInfo = ClientInfo(apiKey: "<apiKey>", apiUrl: "<apiUrl>")
let config = BaseMeasureConfig()
Measure.initialize(with: clientInfo, config: config)
// In your AppDelegate's application:didFinishLaunchingWithOptions:
#import <Measure/Measure.h>

ClientInfo *clientInfo = [[ClientInfo alloc] initWithApiKey:@"<apiKey>" apiUrl:@"<apiUrl>"];
BaseMeasureConfig *config = [[BaseMeasureConfig alloc]
    initWithEnableLogging:YES
    autoStart:YES
    requestHeadersProvider:NULL
    maxDiskUsageInMb:50
    enableFullCollectionMode:NO
    enableDiagnosticMode:NO
    enableDiagnosticModeGesture:NO];
[Measure initializeWith:clientInfo config:config];

4. Verify installation

Add a test crash after Measure.initialize, run the app, and confirm it reaches your dashboard.

// In your AppDelegate, after Measure.initialize.
// The 2-second delay gives the SDK time to flush the crash event.
// Remove this after the crash appears in your dashboard.
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
    fatalError("Test crash from Measure")
}

Remove the test crash code once you've confirmed the crash appears in your dashboard.

Think this page can be better?

Open an issue