简体   繁体   中英

Proper use of “content-available” in iOS 7 Push Notifications

I'm just looking for some feedback on my thought process surrounding iOS 7 and the "content-available" key value in a push notification payload.

Scenario: I force shut down the application. According to Apple because I've done this I will no longer receive any notifications that contain the key value "content-available" in their payload. This means that the alert doesn't show at all, basically nothing happens. No sounds, no alert message, no badge increment.

Theory: Because of the above scenario it seems as if you'd want to send two push notifications.

  1. A push notification with just your "alert","badge" and "sound" values so that the user sees a notification related to the update irregardless of the application state.

  2. A push notification with just the "content-available" key value. If the app is in a state where it can accept this it does and your background task is performed. In the case it can't accept it the user still receives a visual / audible notification from the first push notification.

Question: Is this how Apple intends the silent / background notifications to be executed? I don't really see another way that you could implement this.

I think your thought process is right and the information you have is correct for the current implementation of push notifications in iOS 7.0

However people have been filing bug reports and talking about the fact that forcibly quitting the app makes it ineligible to be woken up by a push notification with "content-available" in the payload (See SO answer ). Hopefully Apple will address this in iOS 7.1 or at least update the docs.

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