iOS SDK - Uninstall Tracking

Uninstall Tracking

Track app uninstalls to measure user retention and optimize re-engagement campaigns by integrating Apple Push Notification Service (APNs) with the Singular SDK.

Important: Uninstall tracking requires APNs configuration in your app. See Apple's UserNotifications Framework documentation for complete implementation details.

Prerequisites

Configure Singular Platform

Before implementing uninstall tracking in your app, configure your app in the Singular platform following the guide Setting Up iOS Uninstall Tracking .


System Requirements

Uninstall tracking requires Apple Push Notification Service and specific device configurations.

APNs Requirements ( source ):

  • iOS Version: Devices must run iOS 10.0 or higher for UserNotifications framework
  • APNs Certificate: Configure APNs certificates or tokens in Apple Developer portal
  • Push Capability: Enable Push Notifications capability in Xcode project settings
  • User Permission: Request and obtain user authorization for push notifications

Note: Users who decline push notification permissions or use devices without APNs support will not be tracked for uninstalls.


Implementation Steps

Step 1: Enable Push Notifications

Configure your Xcode project to support push notifications if not already enabled.

  1. Open your project in Xcode
  2. Select your app target and go to Signing & Capabilities
  3. Click + Capability and add Push Notifications
  4. Ensure Remote notifications is checked in Background Modes

Step 2: Request User Authorization

Request permission from users to receive push notifications using the UserNotifications framework.

Swift Objective-C
import UIKit
import UserNotifications

class AppDelegate: UIResponder, UIApplicationDelegate {
    
    func application(_ application: UIApplication, 
                    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        
        // Set notification delegate
        UNUserNotificationCenter.current().delegate = self
        
        // Request authorization for notifications
        let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
        UNUserNotificationCenter.current().requestAuthorization(options: authOptions) { granted, error in
            if let error = error {
                print("Notification authorization error: \(error.localizedDescription)")
            }
            
            if granted {
                // Register for remote notifications on main thread
                DispatchQueue.main.async {
                    application.registerForRemoteNotifications()
                }
            }
        }
        
        return true
    }
}

Step 3: Register APNs Device Token

Retrieve the APNs device token and send it to Singular for uninstall tracking.

Retrieve and Set Token

Implement the didRegisterForRemoteNotificationsWithDeviceToken callback to capture the APNs token and register it with Singular.

Swift Objective-C
import Singular

func application(_ application: UIApplication, 
                didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    
    // Register the device token with Singular for uninstall tracking
    Singular.registerDeviceToken(forUninstall: deviceToken)
    
    print("APNs device token registered with Singular")
    
    // Also send to your server if needed for your own push notifications
    sendTokenToServer(deviceToken)
}

func application(_ application: UIApplication, 
                didFailToRegisterForRemoteNotificationsWithError error: Error) {
    print("Failed to register for remote notifications: \(error.localizedDescription)")
}

private func sendTokenToServer(_ deviceToken: Data) {
    // Implement your server communication logic here
}

Best Practice: Call registerDeviceTokenForUninstall immediately when the token is received to ensure uninstall tracking is enabled from the first app session.


Token Data Format

Pass the APNs device token to Singular in its native binary format as received from Apple.

Important: The APNs token is binary data (NSData/Data). Pass it directly to Singular without conversion. If your app needs to convert the token to a hex string for other purposes, maintain the original NSData object for Singular.

Example hex format: b0adf7c9730763f88e1a048e28c68a9f806ed032fb522debff5bfba010a9b052


Verification and Troubleshooting

Verify Implementation

Confirm uninstall tracking is working correctly.

  1. Check Logs: Verify APNs token registration appears in your logs
  2. Test Token Generation: Ensure tokens are generated on first app launch
  3. Monitor Dashboard: Check Singular dashboard for uninstall tracking data after 24-48 hours
  4. Test Permissions: Verify notification authorization prompt appears and functions correctly

Common Issues

  • Token Not Generated: Verify Push Notifications capability is enabled in Xcode and APNs certificates are configured in Apple Developer portal
  • User Declined Permissions: Implement logic to handle declined notification permissions gracefully
  • Missing Data: Ensure devices run iOS 10.0+ and users have granted notification permissions
  • Configuration Error: Confirm uninstall tracking is enabled in Singular platform settings
  • Simulator Limitations: APNs tokens are not available in iOS Simulator; test on physical devices

Additional Resources: For detailed troubleshooting, see the Uninstall Tracking Setup Guide and Apple's UserNotifications Documentation .