2

プッシュ通知とローカル通知の両方を備えた iOS アプリを開発しています。センターから 1 つとすべての通知を削除する方法を知っています。

使用して

[[UIApplication sharedApplication]cancelAllLocalNotifications];

しかし、私の問題は、いくつかのローカル通知をスケジュールした場合です。

とプッシュ通知が届いたのでdidReceiveRemoteNotification 書き込みます

[[UIApplication sharedApplication]cancelAllLocalNotifications];明確な通知センターのために、

しかし、すべてのLocalNotificationもクリアされます...

NCに合計3つの通知がある場合は編集します。つまり、1つはローカル通知から、2つはプッシュ(サーバーから)からのものです。この場合、どのように処理できますか? 私はNCで最初の通知(サーバーから来る)をタップしています。この場合、どうすればよいでしょうか。私のアプリ バッジは 2 である必要があります。

それから私は何をすべきですか?

4

3 に答える 3

3

The cancelAllLocalNotifications will only cancel the local notifications, its even in the name! Not the push notifications as you can read in the documentation:

Cancels the delivery of all scheduled local notifications.

Since push notifications are server side there is noting to cancel in your app. To remove the push notification from the notification center just set the applicationBadegNumber to 0.

于 2013-10-07T12:14:02.243 に答える
0
于 2013-10-08T16:45:59.537 に答える