ArtSabintsev ArtSabintsev - 1 year ago 94
iOS Question

Apple Push Notification in Background Issue

I'm using as my APNs provider for a test app I'm building. I've confirmed that push notifications are working as I have been able to successfully receive alerts when the app is in the foreground. Also, I have the

value for the
key specified in my plist.

In my app, I'm wanting to send a user's current location data back to my app-specific database when a push notification is received. I don't actually care about the notification payload itself, as the notification is just a means to getting a small piece of info. The app is constantly collecting data in the background and storing it in a persistent

I've put the location sending code in the
method. If my app is in the foreground when I receive a notification, the method gets called. If my app is in the background, the method isn't called.

  • Am I doing something wrong?

  • Is it even possible to execute an API request in
    when the app is in the background and the user hasn't interacted with the notification?**

EDIT: The problem persists even when I use

Note: My NSDictionary full of location data isn't empty. Also, I am not attempting to do any UI manipulation in the background - just trying to perform an API request.

Answer Source

Check the following:

  • Notification payload includes "content-available"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download