The Amp Devcenter Test Developer Hub

Welcome to the Amp Devcenter Test developer hub. You'll find comprehensive guides and documentation to help you start working with Amp Devcenter Test as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

iOS/tvOS/macOS

Amplitude iOS/tvOS/macOS SDK Installation & Quick Start

CocoaPodsCocoaPods

SDK Installation

1. Add dependencies

Cocoapods

  • Add dependency to Podfile.
`pod 'Amplitude', '~> 7.2.0'`
  • Run pod install in the project directory to download dependency.

Swift Package Manager

  • File -> Swift Package Manager -> Add Package Dependency
  • Type in https://github.com/amplitude/Amplitude-iOS when choosing package repo.
  • It will automatically resolve it and located to the latest version.
  • After successfully being added, it will show up as a dependency.

Carthage

  • Please add the following line to your Cartfile.
github "amplitude/Amplitude-iOS" ~> 7.2.0
  • Add #import <Amplitude/Amplitude.h> to import all of the Amplitude header files.

2. iOS advertising Id (Optional)

Please refer to this.

3. Carrier information (Optional)

Please refer to this.

Quick Start

1. Import package/class

#import <Amplitude/Amplitude.h>
import Amplitude

2. Initialize and log an event

// Usually you can initialize the SDK in the `application:didFinishLaunchingWithOptions:` method of your YourAppAppDelegate.m file
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  // Enable sending automatic session events
  [Amplitude instance].trackingSessionEvents = YES;
  // Initialize SDK
  [[Amplitude instance] initializeApiKey:@"API_KEY"];
  // Set userId
  [[Amplitude instance] setUserId:@"userId"];
  // Log an event
  [[Amplitude instance] logEvent:@"app_start"];
  
  return YES;
}
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
  // Enable sending automatic session events
  Amplitude.instance()?.trackingSessionEvents = true
  // Initialize SDK
  Amplitude.instance()?.initializeApiKey("API_KEY")
  // Set userId
  Amplitude.instance()?.setUserId("userId")
  // Log an event
  Amplitude.instance()?.logEvent("app_start")
      
  return true
}

Usage & Examples

Please see the SDK Usage & Examples page.

Need Help?

If you have any problems or issues over our SDK, feel free to create a github issue or submit a request on Amplitude Help.

Updated 17 days ago


iOS/tvOS/macOS


Amplitude iOS/tvOS/macOS SDK Installation & Quick Start

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.