简体   繁体   中英

Background push notifications sent through Parse are not delivered

I'm trying to send “background push” ( content-available ) notifications to an iOS device. The receiving code works fine, as verified by the Houston command-line utility. I can also send regular push notifications just fine through Parse. But as soon as I add the content-available key (setting it to @YES ), the push notifications are never delivered. Trying with different alert and sound values does not change anything. When I look into the Parse web “console” under the Push Notifications tab, the “Subscribers” value for these undelivered notifications is zero. What am I doing wrong?

Try to set "content-available " to @"1" instead of @yes

For example, my working code:

NSDictionary *data = [NSDictionary dictionaryWithObjectsAndKeys:
                           @"", @"alert",
                          @"1", @"content-available",
                          nil];
PFPush *push = [[PFPush alloc] init];
[push setQuery:someQuery];
[push setData:data];
[push sendPushInBackground];

Perhaps you are not registering to the correct notification types.

Try :

[[UIApplication sharedApplication] registerForRemoteNotificationTypes: UIRemoteNotificationTypeNewsstandContentAvailability]; 

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