iOS SDK

Guide for installing the Qonversion SDK for iOS

​

Current version​Version​​

Prerequisites

  • XCode 9.2 or higher

  • Target of iOS 9 or higher

Installation

To integrate Qonversion, simply use CocoaPods:

  1. ​Install CocoaPods (put sudo gem install cocoapod in terminal).

  2. Run pod init in project's directory if you do not have a Podfile.

  3. In the Podfile, add pod 'Qonversion', '~> 1.0' in your main target.

  4. Run pod install.

  5. From now on, open your project with the .xcworkspace.

Set up Qonversion

1. Import the Qonversion module in your AppDelegate:

Swift
Objective-C
Swift
import Qonversion
// import FBSDKCoreKit // For Facebook Ads integration
// import Amplitude_iOS // For Amplitude integration
Objective-C
#import "Qonversion.h"
// #import "FBSDKCoreKit.h" // For Facebook Ads integration
// #import "Amplitude.h" // For Amplitude integration

2. Get your application key and configure Qonversion in your app inapplication:didFinishLaunchingWithOptions: method.

To get the key, go to the settings in your Qonversion account and copy the Application Access Key:

Configure Qonversion with the key obtained above inapplication:didFinishLaunchingWithOptions: method:

Swift
Objective-C
Swift
Qonversion.launch(withKey: "ApplicationKey") { (uid) in
// This uid is needed for Facebook Ads integration:
// AppEvents.userID = uid
// This uid is needed for Amplitude integration:
// Amplitude.instance()?.setUserId(uid)
}
Objective-C
[Qonversion launchWithKey:@"projectKey" completion:^(NSString * _Nonnull uid) {
// This uid is needed for Facebook Ads integration:
// [FBSDKAppEvents setUserID:uid];
// This uid is needed for Amplitude integration:
// [[Amplitude] instance] setUserId:uid];
}];

​

If you want to use your custom user id instead of Qonversion User-Id:

Swift
Objective-C
Swift
Qonversion.launch(withKey: "ApplicationKey", userID: "yourSideUserID")
Objective-C
[Qonversion launchWithKey:@"projectKey" userID:@"yourSideUserID"];

50% Done!

Now Qonversion will automatically track every purchase event - trials, subscriptions, and purchases - in the App.

Provide Shared Secret

1. Log in to your App Store Connect account. Go to "My Apps" and select the App.

2. Open your App in AppStore Connect and perform these steps to copy Shared Secret:

3. Provide this Shared Secret to your qonversion.io account:

90% Done!

From now on, Qonversion will track subscription events independent from a user's device (e.g., if the App was not opened or even deleted).

Next Steps