iOS Uninstall Tracking

Note

应用卸载跟踪从Airbridge iOS SDK v1.13.0及更高版本开始可用。

设置

Airbridge SDK的卸载跟踪功能通过使用静默推送实现。因此,为了使用此功能,需要在应用中设置App Identifier和Capabilities以启用静默推送,以及添加当应用接收到以卸载跟踪为目的的静默推送时忽略该推送的代码。

Project 设置

在App Identifier中启用Push Notification

  1. 请转到 https://developer.apple.com/account/resourcesIdentifiers

  2. 请点击要进行卸载跟踪的应用的 Identifier,并勾选 Push Notifications

在Key中启用Push Notification

1. 请转到 https://developer.apple.com/account/resourcesKeys

2. 编辑使用中的Key,然后勾选 Apple Push Notification服务。

如果没有使用中的Key,请按+按钮创建新的Key并下载p8

App信息设置

App ID Prefix和Bundle ID设置

  1. 请转到 https://developer.apple.com/account/resources 的 Identifiers

  2. 请点击要进行卸载跟踪的App的 Identifier

  3. 您可以查看该App的 App ID PrefixBundle ID

上传Key的p8

  1. 请转到 https://developer.apple.com/account/resourcesKeys

  2. 请点击正在使用的 Key

  3. 您可以查看该 KeyKey IDp8

p8只能在首次创建Key时下载。

App设置

添加Capabilities

  1. 请转到 Xcode> Project文件> Signing & Capabilities

  2. 请点击 + Capability按钮。

  3. 请添加 Background ModesPush Notifications

  4. 请勾选 Background ModesRemote notifications

静默推送设置

当应用启动时,如果之前没有使用Push Notification,请调用 registerForRemoteNotifications函数。

1234567
func application(_ application: UIApplication,
                 didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool
{
    ...
    UIApplication.shared.registerForRemoteNotifications()
    ...
}

APNs Push Token发送

当APNs Push Token生成时,请调用registerPushToken函数将该Token传递给SDK。

12345
func application(_ application: UIApplication,
                 didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data)
{
    AirBridge.registerPushToken(deviceToken)
}

忽略用于卸载跟踪的静默推送

当收到用于卸载跟踪的静默推送时,请添加以下代码忽略该推送。

12345678910
func application(_ application: UIApplication,
                 didReceiveRemoteNotification userInfo: [AnyHashable : Any],
                 fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void)
{
    if userInfo["airbridge-uninstall-tracking"] as? Bool == true {
        return;
    }
  
    ...
}

故障排除

Morpheus Push SDK Troubleshooting guide

Morpheus Push SDK Troubleshooting guide: 预计以后提供。

Was this page helpful?

Have any questions or suggestions?