简体   繁体   中英

APNS and iOS 5 Notification Center

I'm using iOS 5 and Push Notifications (with notification bar).

I have received 5 notifications that are available in the notification center. When I tap on any of them, the app launches and I am presented with the payload dictionary in application:didFinishLaunchingWithOptions. After this point, all other notifications related to the app disappear from the notification center.

I want to know if I can achieve any of the following

  • I can let the unread (untapped) notifications be available in the notification list (for later viewing).
  • I can get the payload(s) of all unread notifications in application:didFinishLaunchingWithOptions when I tap any one unread notification.

For notifications to remain in Notification Center after your app has been launched from one of them, their payload needs to include a badge number, and your app needs to refrain from setting its badge counter to 0 until it wants to clear all of its notifications from the Notification Center.

There is no way to access the notification payload of APNS messages other than the one your app was launched from. The general best practice if you need that data—particularly considering that APNS delivery is not guaranteed—is to retrieve it separately from your own web service.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM