通知タイプの(local
またはremote
)通知を取得する方法はありますかuserNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:
?userNotificationCenterから通知タイプを取得しました:didReceiveNotificationResponse:withCompletionHandler:
私は自分のアプリの内部解析モジュールを開発中です。各アプリでは、通知userInfoと通知タイプ(ローカルまたはリモート)からアナリティクスサーバー固有の情報を送信する必要があります。
私は、次のコードを使用していuserInfo
を取得するには:もちろん
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)())completionHandler {
NSDictionary *userInfo = response.notification.request.content.userInfo;
//app-specific logic goes here
}
をローカル通知をスケジュールするとき、私は通知タイプを取得するためにuserInfo
に(各アプリに)特定のパラメータを追加することができます。しかし、より多くの可能性があります私は欲しいものを行う方法が存在します。
もう一つのオプションは、 'response.notification.request.trigger'を使用して通知の種類を決定することです。トリガなし==ローカル、UNPushNotificationTrigger ==リモート。 –
またはむしろUNPushNotificationTrigger ==リモート、他のトリガー==ローカル。 –