简体   繁体   中英

iOS: Determine if there are notifications in the Notification Center

I am working on an application right now and need to determine if there are any notifications (for this app, of course) in the notification center. I'd like to know if anyone knows a way to access the app's notifications in the notification center.

I am not sure if I understand your correctly. If you want to retrieve the list of notifications from APNS, the only and the "proper" way to do it is to rely on standard push notification mechanism (you can find that in any Push Notification tutorial). Simply catch notification when they comes, and store them somewhere, within a NSArray maybe.

There is no way to retrieve push notifications when they are still on the server . This is, obviously, because they haven't come to the device yet!

If you ask about push notifications: You can't access notifications in the notification centre. However you can store all the notifications on your server.

Be aware that the delivery of push notifications is not guaranteed.

From Local and Push Notification Programming Guide: More About Push Notifications

... you should never use the remote-notification mechanism for data transport because delivery of push notifications is not guaranteed.

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