Background push notifications arrive when code is executed via XCode but not if running independently of XCode [closed]

StackOverflow https://stackoverflow.com/questions/23413219

  •  13-07-2023
  •  | 
  •  

Frage

I'm observing a strange situation with background push notifications. (Note I mean the new iOS7 background push, I am not talking about regular pushes when the app is in the background).

If I run my app using XCode and send it to the background and send it some background push notifications then they are all received (and almost instantly).

But then if I run the app by starting it manually from the device and send it some more pushes none of them are received when the app is in the background (but it receives them if the app is in the foreground).

This is 100% repeatable - I can switch back to running via XCode and all pushes are received in the background. Switch back to running manually and none are received in the background.

Anybody any idea what's going on?

(I'm checking if they are arriving or not by observing NSLog output to Organizer's console).

War es hilfreich?

Lösung

EDIT: Problem seems to be an Apple regression bug, see comments.

Not an answer as to why but my comments are too large to go in the comments section.

Firstly I've noticed that the background behavior of apps is different when you run them via Xcode, so if you are developing and testing any sort of background behavior DON'T rely just on testing running via Xcode. Make sure you run the apps manually as you are doing as there is a difference in behavior.

Secondly I've seen something similar to yourself - which is that turning wifi on/off is having an effect on my apps ability to receive background pushes:

1) have app running in background with wifi off and send a push, chances are the app doesn't get it

2) have app running in background with wifi on and send a push, the app will get it

3) have app running in foreground and turn wifi off and send a push, the app will get it.

I don't see why 1) should be causing a problem - if wifi is off the push can still get through to the app as evidenced by 3). As to why wifi on/off is having an effect on the push not being delivered to the app when the app is in the background I have no idea and suspect it could be an Apple bug?

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top