Apple Update Token
SDK Version Selection
Choose your SDK version below:
- Apptrove SDK → Recommended for all projects (Latest: v2.0.1)
- Trackier SDK → Will be deprecated in May 2026 (v1.x.xx)
Use the tabs below to view Apple Update Token code for your chosen SDK.
The Apple Update Token allows you to update Apple's Ads Attribution token for enhanced tracking on iOS devices.
What is Apple Update Token?
Apple's Ads Attribution token helps maintain user attribution across app updates and reinstalls, ensuring continuous tracking and data continuity.
Library Reference
AdServices Framework
The AdServices framework provides access to Apple's attribution token.
Documentation: Apple AdServices Framework
Requirements
- iOS 14.3 or later
- AdServices framework
- Xcode 12.0 or later
Usage
Basic Implementation
- ✓ Apptrove SDK (Recommended)
- Trackier SDK (Deprecating May 2026)
import ApptroveSDK // or import apptrove_ios_sdk
import AdServices
// Update Apple Ads token
func updateAppleAdsToken() {
if #available(iOS 14.3, *) {
if let token = try? AAAttribution.attributionToken() {
AppTroveSDK.updateAppleAdsToken(token: token)
}
}
}
import TrackierSDK // or import trackier_ios_sdk
import AdServices
// Update Apple Ads token
func updateAppleAdsToken() {
if #available(iOS 14.3, *) {
if let token = try? AAAttribution.attributionToken() {
TrackierSDK.updateAppleAdsToken(token: token)
}
}
}
Complete Example
- ✓ Apptrove SDK (Recommended)
- Trackier SDK (Deprecating May 2026)
import ApptroveSDK // or import apptrove_ios_sdk
import AdServices
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Initialize SDK
let config = AppTroveSDKConfig(
appToken: "xxxx-xx-xxx-xxx", // Pass your AppTrove SDK API key
env: AppTroveSDKConfig.ENV_DEVELOPMENT
)
// Get Apple Ads token before initializing SDK
if #available(iOS 14.3, *) {
if let token = try? AAAttribution.attributionToken() {
AppTroveSDK.updateAppleAdsToken(token: token)
} else {
print("[DEBUG] Failed to fetch Apple Ads Attribution token")
}
}
AppTroveSDK.initialize(config: config)
return true
}
}
import TrackierSDK // or import trackier_ios_sdk
import AdServices
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Initialize SDK
let config = TrackierSDKConfig(
appToken: "xxxx-xx-xxx-xxx", // Pass your Trackier SDK API key
env: TrackierSDKConfig.ENV_DEVELOPMENT
)
// Get Apple Ads token before initializing SDK
if #available(iOS 14.3, *) {
if let token = try? AAAttribution.attributionToken() {
TrackierSDK.updateAppleAdsToken(token: token)
} else {
print("[DEBUG] Failed to fetch Apple Ads Attribution token")
}
}
TrackierSDK.initialize(config: config)
return true
}
}
Function Reference
| Method | Description | Parameters | Returns |
|---|---|---|---|
updateAppleAdsToken(token:) | Update Apple Ads token | String | Void |
Where to Add
- App Launch: Update token when your app starts
- Token Refresh: Update when you receive a new token from your server
- Deep Link Handling: Update token before processing deep links
Best Practices
- Validate Token: Ensure token is not empty and has proper format
- Error Handling: Wrap in try-catch for network errors
- Storage: Store token securely for future use
- Availability Check: Always check iOS version before using AdServices
- Null Safety: Handle optional values properly in Swift
Support
For issues with Apple Update Token implementation, refer to our Support page.