Installation
This guide provides step-by-step instructions to integrate the AppTrove iOS SDK into your iOS application using CocoaPods. It covers adding the SDK dependency and configuring AppTrackingTransparency for IDFA collection.
Prerequisites
- iOS 10.0 or later
- Xcode 12.0 or later
- CocoaPods installed for dependency management
- A Trackier MMP account with an SDK key
- Access to your project's
Podfile
andInfo.plist
Installation
Step 1: Add AppTrove SDK via CocoaPods
To integrate the AppTrove iOS SDK, configure your Podfile
to include the SDK dependency.
1.1 Update the Podfile
In your project's Podfile
, add the following line:
pod 'trackier-ios-sdk'
1.2 Install Dependencies
Run the following command in the terminal from your project directory:
pod install
1.3 Open the Workspace
Open the generated .xcworkspace
file in Xcode to build and run your project.
Step 2: Configure AppTrackingTransparency (Optional)
For apps targeting iOS 14.5 and later, you must request user permission to access the Identifier for Advertisers (IDFA) using Apple's AppTrackingTransparency (ATT) framework.
2.1 Add Permission Description
Add the following key-value pair to your Info.plist
to describe why your app needs tracking permission:
<key>NSUserTrackingUsageDescription</key>
<string>We use tracking to personalize your experience and improve our services.</string>
2.2 Request Tracking Permission
In your app (e.g., in AppDelegate
or a view controller), request tracking authorization. Below is an example implementation:
import AppTrackingTransparency
func requestTrackingPermission() {
if #available(iOS 14, *) {
ATTrackingManager.requestTrackingAuthorization { status in
switch status {
case .authorized:
print("Tracking authorized")
case .denied:
print("Tracking denied")
case .notDetermined:
print("Tracking not determined")
case .restricted:
print("Tracking restricted")
@unknown default:
print("Unknown tracking status")
}
}
}
}
Call requestTrackingPermission()
at an appropriate time in your app's lifecycle, such as during onboarding or when tracking is needed.
Example Application
For a sample implementation, refer to the Example directory in the AppTrove iOS SDK GitHub repository. To explore the example project:
- Clone the repository.
- Navigate to the
Example
directory. - Run
pod install
to set up dependencies. - Open the generated
.xcworkspace
file in Xcode to build and run the app.
Next Steps
After completing the installation:
- Initialize the AppTrove SDK in your app.
- Test your integration to ensure proper tracking of installs and events.
- Contact Trackier support at support@trackier.com for assistance.
For the latest version of the AppTrove iOS SDK and additional resources, visit the Trackier Documentation Portal.