iOS 7 Background Fetch When the App is Not Running

不问归期 提交于 2019-12-02 19:44:26

Edit 2: Note that if a user kills the app from the app switcher, the background fetch will never happen again. This is working as Apple intended. See the related "Understanding When Your App Gets Launched into the Background" docs for details:

In most cases, the system does not relaunch apps after they are force quit by the user. One exception is location apps, which in iOS 8 and later are relaunched after being force quit by the user.

And an old developer forums post (the link unfortunately no longer exists)...

"If you kill an app from the multitasking UI, the system will never automatically launch the app again. The logic here is that, if the user has killed your app, they probably want it to stay dead."

You could make a simple GET request, eg: "http://dev.example.org/?ping=1" to your web server then grep the access.log on the web server for "?ping=1"

Edit: Another method to test the app being launched in the background (eg: without being able to double tap the home button and switch to it) is by creating a background-only scheme. Go to Product -> Scheme -> Manage Schemes and then duplicate your default scheme.

Then edit the new scheme and click the Options tab and check "Launch due to a background fetch event" - when you run your app it'll be launched directly into the background, as it would through normal use.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!