Silent Push Notification in iOS 7 Does Not Work

Silent Push Notification in iOS 7 does not work

This works also and does not play a sound when it arrives:

{
aps = {
"content-available" : 1,
sound : ""
};
}

EDIT

People having this problem may want to check out this link. I have been participating in a thread on Apple's Developer forum that goes over all app states and when silent pushes are received and not received.

Silent push notification doesn't work on iOS7 in background mode

As pointed in this tread, aps need to include priority in order to work in iOS7.

 aps =     {
badge = 7;
"content-available" = 1;
priority = 5;
};

check this : https://stackoverflow.com/a/23917593/554740

Silent push notification (APNS) can not received

You question is twofold:
1. why the two delegate callbacks can not be invoked
2. what should you do to receive the data.

I did some hand test and here is the result:

1, when an app is in killed state, the two callback can not be invoked indeed
2. however, when you open the app next time,

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
......
}

can be invoked and you can get the data from there.

I hope this is useful.

Silent push notification not working on foreground iOS app

Well, after struggling with this for days I stumbled upon my answer barely an hour after posting this question.

To get background notifications delivered to your app you must call UIApplication.shared.registerForRemoteNotifications() every time your app is launched. I was skipping the call if I already had the token and this was causing my delegate method to not be called.



Related Topics



Leave a reply



Submit