アンインストール計測

概要

次のセクションに従って、iOSアンインストールの設定、実装、計測テストを実施してください。

  1. Creating a .p12 certificate and sending it to the marketer.
  2. アンインストール計測用のSDKの構成
  3. アンインストール計測のテスト

Creating a .p12 certificate

To enable uninstall measurement, a .p12 certificate is required.

📘

注意

Currently, .p8 certificates are not supported.

To create a .p12 certificate:
Step 1: Create a Certificate Signing Request (CSR)
1.1. On your Mac, open Keychain Access. Go to Keychain Access > Certificate Assistant > Request a Certificate From a Certificate Authority.

1.2. フォームを入力した後、ディスクに保存 を選択し、続行をクリックします。

ステップ2:アプリIDの選択
2.1. If your Apple App ID is already registered, locate it in Apple Developer Members Center and skip to step 2.8.

If you need to create a new Apple App ID, in the Apple Developer Members Center, Go to Identifiers and click +.

878

2.2. Choose App IDs and click continue

2.3. Choose App and click continue

2.4. Under Register an App ID, in the Description field, provide the description for your app.

2.5. In the Bundle ID field, enter the app Bundle ID.

2.6. Click Continue.

2.7. Under Edit your App ID Configuration, select Push Notifications and click Configure to continue with the setting. Once your done skip to Step 3: Upload CSR below.

2.8. In the Register an App ID view, under Capabilities, check Push Notifications and click Configure (Edit if it was previously configured). If the Configure/Edit button is not available, you might not have the required permissions.

ステップ 3: CSR をアップロードする
3.1. Production(実稼働版)または開発用のSSL証明書のどちらを作成するかを選択し (注を参照)、 証明書の作成をクリックします。

📘

注意

公開されているアプリには、 Production SSL Certificate を使用します。アプリが未公開で、アクティブに開発中の場合は、 Development SSL Certificate を使用します。たとえば、アプリがまだ公開される準備ができていない場合、開発用のSSL証明書を使用すると、TestFlightでプッシュ関連の機能をテストできます。

3.2. 手順 1 で作成したCSRをアップロードし、続行をクリックします。

3.3. ダウンロードの準備が完了すると、Downloadボタンが表示されます。これが更新されるには、ページを再度読み込む必要がある場合があります。新たに作成した証明書をダウンロードしてください。

1006

ステップ4:.12ファイルの作成
4.1. Open the .cer certificate. Opening the certificate will open Keychain Access.
4.2. In the Keychain Access, your certificate is shown under My Certificates. Select the certificate that was just added to Keychain Access.
4.3. Right-click on your certificate and select Export.

670

4.4. 保存をクリックします。必ず Personal Information Exchange (.p12) フォーマットを使用してください。

774

📘

注意

開発用または実稼働用のプッシュ SSL 証明書を更新する場合は、前述の手順に従ってください。この変更を行うために、以前の証明書を失効させる必要はありません。新しい証明書をアップロードする間に古い証明書を使用し続けるために、2つの本番環境用の証明書を同時に使用できます。

Step 5: Upload .p12 to AppsFlyer
Send the .p12 certificate to the marketer to upload to AppsFlyer.

SDKのセットアップ

次のコードを AppDelegate に追加します。

    	//add UserNotifications.framework
import UserNotifications
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // ...
        application.registerForRemoteNotifications()        
        return true
      }
    
     // Called when the application sucessfuly registers for push notifications
      func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
        AppsFlyerLib.shared().registerUninstall(deviceToken)
      }
// AppDelegate.h
#import <AppsFlyerLib/AppsFlyerLib.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate, AppsFlyerLibDelegate>

// AppDelegate.m
- #import <UserNotifications/UserNotifications.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        // The userNotificationTypes below is just an example and may be changed depending on the app
     UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
              center.delegate = self;
              [center requestAuthorizationWithOptions:(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error) {
              }];
       [[UIApplication sharedApplication] registerForRemoteNotifications];
        // if you do not use push notificaiton in your app, uncomment the following line
        //application.applicationIconBadgeNumber = 0;
      }
      - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
        [[AppsFlyerLib shared] registerUninstall:deviceToken];
      }
}

バックグラウンドモードでのプッシュ通知の有効化

サイレントプッシュ通知のみを使用している場合は、アプリのCapabilitiesバックグラウンドモードリモート通知を必ず有効にしてください。

  1. XCodeでプロジェクトを選択します。
  2. ターゲットを選択してください。
  3. Capabilities(機能)タブに切り替えてください。
  4. トグル Background Modes をオンにしてください。
  5. Remote notificationsにチェックを入れてください。

アンインストール計測のテスト

iOSアンインストール計測のテスト方法:

  1. アプリをインストールします。
  2. アプリをアンインストールします。 注記:アプリをインストールした直後にアンインストールできます。 

Xcodeまたは TestFlight からアンインストールテストをする場合は、トークンがサンドボックス環境から生成されていることをSDKに知らせることが重要です。次のAPIを使用します。

AppsFlyerLib.shared().useUninstallSandbox = true
[AppsFlyerLib shared].setUseUninstallSandbox = true;

📘

注意

setUseUninstallSandbox must be called before calling registerUninstall.

注意事項

アンインストールはAppsFlyer管理画面には即座に表示されません。Apple プッシュ通知サービスの仕様により、次のようになります:

  • アンインストールがレポートに表示されるまでに平均9日かかります。
  • サンドボックス環境から発生したアンインストールがレポートに表示されるには、 1 か月以上かかる場合もあります。
  • アンインストールの日付は、 アンインストールが報告された日付です。例:
    • 1日目:ユーザーがアプリをインストールします
    • 4日目:ユーザーがアプリをアンインストールします
    • 12日目:アンインストールから8日後にApple Push Notification Service がアプリの削除をレポートします
    • 13日目:AppsFlyer管理画面とローデータにアンインストールデータが表示されます