このページでは

For AI agents: a documentation index is available at /docs/llms.txt. Append .md to any page URL for markdown, or send Accept: text/markdown.

Install an Amplitude mobile SDK

このページはまだあなたの言語に翻訳されていません。 現在取り組んでいますので、後でもう一度確認してください。

For mobile engineers10 minBeginner

This quickstart installs an Amplitude SDK in a mobile app. Pick your platform: iOS (Swift), Android (Kotlin), React Native, or Flutter. Each platform takes three steps: install, initialize, and track your first event.

Prerequisites

  • An Amplitude project and its API key. Create a free Amplitude account if you need one.
  • Access to your app's codebase.

Install the SDK

The Unified SDK for Swift includes Analytics, Experiment, and Session Replay.

  1. Install

    Add the SDK to your Xcode project

    Choose Swift Package Manager or CocoaPods to install the Unified SDK.

    Swift Package Manager: In Xcode, navigate to File > Add Package Dependencies and enter:

    text
    https://github.com/amplitude/AmplitudeUnified-Swift
    

    CocoaPods: Add to your Podfile, then run pod install:

    ruby
    pod 'AmplitudeUnified', '~> 0.0.4'
    
  2. Initialize

    Initialize the SDK

    Add this to your app delegate or @main entry point:

    swift
    import AmplitudeUnified
    
    let amplitude = Amplitude(apiKey: "AMPLITUDE_API_KEY")
    
  3. Track

    Track your first event

    swift
    amplitude.track(eventType: "Button Clicked")
    

For full configuration options, refer to Unified SDK for Swift.

Confirm that events arrive

After you track your first event, open the Amplitude Debugger to confirm that it reaches your project.

これは役に立ちましたか?