Reputation: 236
I have registered for remote notifications fine
I have the deviceToken, the server is using it, it's sending messages to my test user, and when the app is in foreground I breakpoint and receive incoming remote notifications.
But when the app is backgrounded, nothing.
SSL certs signed for dev and prod. Currently, I using the dev push.pem with sandboxed APNS address, against a iOS Developer signed profile.
Help?
Upvotes: 3
Views: 294
Reputation: 236
Thank you for the suggestions but the problem has been resolved, it was an issue with the server payload
1 Our server is using a third party push notification library 2 this library was wrapping our json payload
Our payload
aps: { alert: ...,
With another layer
aps: { alert: { aps: { alert: ...,
Apple's APNs wasn't complaining one bit because the json is not malformed and totally legitimate and within size
I found this out after looking at the incoming notifications, while my iphone was run from/connected to Xcode.
Human error, server side
Upvotes: 2
Reputation: 2298
Do as @karlos Suggest.
And also add "content-available":1
in your payload because by providing this key with a value of 1 will indicate that new content is available. Including this key and value means that when your app is launched in the background or resumed, application:didReceiveRemoteNotification:fetchCompletionHandler:
is called.
For more information follow this link.
Upvotes: 2
Reputation: 1661
Set the "Remote Notification" on in your app Capabilities as shown in the figure below:
Hope this might be helpful.
Upvotes: 3