2

I can receive Push Notifications in my iOS app without problems, but if I try to send a Silent Notification adding "content-available": 1, I will not receive any notifications no matter the state of my app (even if it is running in the foreground)

I have checked the Remote Notifications checkbox. (or added remote-notification in .plist) and I have implemented application:didReceiveRemoteNotification:fetchCompletionHandler but didReceiveRemoteNotification only is called if I send a normal push notification and the app is running in the foregound

Any idea??

Kara
  • 6,115
  • 16
  • 50
  • 57
user1285413
  • 65
  • 1
  • 2
  • 7

2 Answers2

2

Check out this answer on SO: Silent Push Notification in iOS 7 does not work

Seems like there is a bug that requires another field to be present for the remote notification to be valid.

Community
  • 1
  • 1
Rajiev Timal
  • 106
  • 4
2

I have tested on iOS 7.0.6 to send a slient push with the payload:

{"aps":{"content-available":1}}

and worked fine, here is my userInfo object on Xcode:

2014-05-09 11:04:23.737 SilentPushTest[316:60b] PAyload {
    aps =     {
        "content-available" = 1;
    };
}

You can test sending push easily with this app:

https://bitbucket.org/jesuslg123/pushmebaby

Just need to add your app certificate with the name apns.cert and compile it.

Jesuslg123
  • 726
  • 6
  • 16
  • Can you please post your didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler in the app delegate ? – Sharme May 30 '14 at 07:26
  • 1
    Don't forget to enable on "Capabilities" the "Background Modes" and active the "Remote notifications" inside. `- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { [logHelper addLogWithText:[NSString stringWithFormat:@"PAyload %@", userInfo.description]]; }` I'm not sure how to properly format the code on the comment... @S_O – Jesuslg123 Aug 28 '14 at 09:15