-->

iOS silent push notification only works when conne

2019-04-26 00:06发布

问题:

I have an odd issue.

I recently updated my Xcode to 6.1.1 to make a change to an app I previously released with Xcode 5 (working great). Now for some reason with the new Xcode when I test my background silent push notification it only completely works when I have my iPhone connected to my Mac?

What the app does is when it gets a silent push the app retrieves data from a server. I added the default sound to the silent push for testing, and I've confirmed that the app does get the push but it does not connect to the server to get the new data. But if I plug in the lightning cable to my mac everything works great, gets data from server etc.

I'm not sure what to do? Any ideas or direction is greatly appreciated.

Thanks!

回答1:

I got no problem to send silent push to my app, even if the app is not connected to Xcode BUT you have to notice that silent push notification is being delivered only if your app is running in the background. If you force quit your app using double tap on iPhone home button, the notification is ignored.

It is probably an Apple rule to let user completely kill an app and stop any outgoing/incoming connection