Note
This guide provides instructions for installing and setting up the iOS SDK v4. For earlier versions, consult the iOS SDK (Previous) guide.
Airbridge sends silent push notifications to users who have performed any app event at least once in the past 6 months to check if they have deleted the app. These notifications are sent daily between 3:00 PM and 4:00 PM (UTC). Uninstall events can be monitored in the Airbridge reports and raw data export files.
Submit your Apple Developer credentials to Airbridge.
Follow the steps below to get the required credentials from the Apple Developer Portal.
To get the APNs authentication key, you first need to turn on the app's push notification from the Apple Developer Portal.
Select [Identifiers] in the Apple Developer Portal.
Find and click on the app you want to track uninstalls. Then, check "Push Notification."
Select [Keys]. Click + to generate a new key. Then, download the APNs authentication key (p8). The APNs authentication key can be downloaded only when creating the key for the first time and cannot be downloaded again. If lost, the key must be regenerated. Up to 2 APNs authentication keys can be generated at once.
The Key ID can be found when clicking on the newly generated key in [Keys].
Navigate to [Certificates, Identifiers & Profiles]>[Identifiers] in the Apple Developer Portal. Click on the app you want to track uninstalls to find the Bundle ID.
Navigate to [Account]>[Membership details] in the Apple Developer Center to find the Team ID (App ID Prefix).
Follow the steps below to submit the credentials to Airbridge.
1. Navigate to [Settings]>[Uninstall Tracking] in the Airbridge dashboard.
2. Select the [iOS] tab.
3. Submit the required credentials.
After submitting all the required credentials to Airbridge, select the app environment to collect push tokens.
Different push tokens are collected depending on the app environment you choose. For example, push tokens collected in the production environment cannot be used in the development environment.
Supported apps: Apps downloaded from the Apple App Store or test apps released via TestFlight, Ad Hoc, or Enterprise.
Push tokens collected: The actual push tokens used for uninstall tracking
Supported app: Development apps for testing purposes that are not supported in the production environment
Push token collected: Push token used in the development environment
In the development environment, you can only proceed with silent push testing. To actually track uninstalls, proceed with a production app.
Test silent push notifications to make sure the notifications are successfully sent to the devices. To proceed with the test, click Test silent push. The silent push test does not measure or generate uninstall events; therefore, uninstalls cannot be confirmed in the Airbridge dashboard.
Conducting the silent push test is recommended as the Bundle ID, which is one of the required credentials for uninstall tracking, can only be validated through the silent push test.
To conduct a silent push test, you need an APNs push token (device token). The push token you collect varies depending on the app environment. You need to check the push token and the app environment before proceeding with a silent push test. Refer to the Apple Developer Documents for instructions on how to find the APNs push token.
Upon sending a silent push to a device from Airbridge, you can check for a success message or an error code. The main error codes that can be received are as follows. For more information about the error codes, refer to the Apple Developer Documents.
Error Code | Meaning |
---|---|
403 (InvalidProviderToken) | Invalid APNs credentials. Enter the correct Key ID and Team ID, and try again. |
400 (TopicDisallowed) | Invalid Bundle ID. Enter the correct Bundle ID, and try again. |
400 (BadDeviceToken) | Invalid push token. The actual app environment and the app environment configuration may not match. |
410 (Unregistered) | Invalid push token. The actual app environment and the app environment configuration may not match, or the user may have deleted the app several days ago. |
410 (ExpiredToken) | Invalid push token. The actual app environment and the app environment configuration may not match, or the user may have deleted the app several days ago. |
Some error codes that indicate that the app has been deleted could show as a result of the silent push test. Regardless, be reminded that the purpose of the silent push test is to verify whether silent push notifications are being sent successfully using the submitted credentials.
Test the silent push notification on a device for testing purposes where the app has been installed recently and retained for the last 10 days.
Attention
You cannot conduct silent push tests on the iOS Simulator.
To track uninstalls on iOS devices, you need to set up identifiers to allow silent push notifications in the app and add capabilities. Also, you need to add code to ignore silent push notifications that are aimed at tracking app deletions.
1. Navigate to [Project File]>[Signing & Capabilities] in Xcode.
2. Click + Capability and select Push Notifications. Then select Background Modes and check "Remote Notification."
You can enable push notifications using the registerForRemoteNotifications
function. If you have not used push notifications before, call this function.
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool
{
...
UIApplication.shared.registerForRemoteNotifications()
...
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[UIApplication.sharedApplication registerForRemoteNotifications];
return YES;
}
After the setup, the application(_:didFinishLaunchingWithOptions:)
function is called every time a push notification, including silent push notifications, is sent. When a silent push notification is sent, this function is called after the app is backgrounded. Even if the app is foregrounded afterward, the function will not be called again.
You can check whether the application(_:didFinishLaunchingWithOptions:)
function was called using launchOptions
. Refer to the code below.
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
let key = UIApplication.LaunchOptionsKey.remoteNotification
let isLaunchRemoteNotification: Bool = launchOptions?[key] != nil
}
When the APNs Push Token is generated, call the registerPushToken
function to pass it to the SDK.
func application(_ application: UIApplication,
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data)
{
AirBridge.registerPushToken(deviceToken)
}
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
[AirBridge registerPushToken:deviceToken];
}
The silent push notifications Airbridge sends for uninstall tracking should not be displayed in the user's app. By adding the exception handling code as below, the silent push will not be exposed to the user.
func application(_ application: UIApplication,
didReceiveRemoteNotification userInfo: [AnyHashable : Any],
fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void)
{
if Airbridge.isUninstallTrackingNotification(userInfo) {
return
}
...
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
if ([Airbridge isUninstallTrackingNotification:userInfo]) {
return;
}
...
}
Once you submit the credentials to the Airbridge dashboard and complete the Airbridge SDK setup, you can switch on the "Enable uninstall tracking" toggle. When switching on the toggle, Airbridge starts tracking uninstalls.
To learn more about uninstall tracking, refer to this Airbridge user guide.
Was this page helpful?