初めてアプリを実行すると、プッシュ通知を許可するかどうか尋ねられるので、[はい]を選択します。これで、設定に移動してアプリのすべての通知をオフにしても、からデバイストークンを取得します- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken;
。私は開発者として、アプリで有効になっているかどうかを追跡する責任がありますか?それともこれはバグですか?
質問する
508 次
1 に答える
3
The device token is generally stored on a server someplace. If the user suddenly decides they want push notifications and turns it back on, their device token has already been generated and stored on your server.
If the device token was not generated, then the user would have to make sure the app has been terminated and then re-launched in order for the device token to get generated.
You can determine if the user has turned off push notifications with the code below
UIRemoteNotificationType remoteNotificationType = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
if (remoteNotificationType == UIRemoteNotificationTypeNone) {
... Do not send push
}
于 2012-05-02T03:17:22.030 に答える