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
Ios: What's the Fastest, Most Performant Way to Make a Screenshot Programmatically
Drop-Down List in Uitableview in iOS
How to Capitalize Each Word in a String Using Swift iOS
Swift Programmatically Navigate to Another View Controller/Scene
Generate a Random Float Between 0 and 1
iOS App Freezes on Pushviewcontroller
Long Press Gesture on Uicollectionviewcell
iOS 11 Disable Password Autofill Accessory View Option
Uitableview Mix of Static and Dynamic Cells
Force Landscape Orientation in Uiimagepickercontroller
How to Initialize/Instantiate a Custom Uiview Class with a Xib File in Swift
Wrong Color in Interface Builder
Xcode Is Looking for Core Data Entity Names with Dot; Not Compiling
iOS 8 - Can't Install Enterprise App
How to Change Color of Single Word in Uitextview and Uitextfield