当应用程序在后台时如何进行网络呼叫

How to make network call when the app is in background too

我有一个应用程序,如果它进入后台,它必须每 1 分钟进行一次网络 API 调用。

到目前为止,我的研究表明这是不可能的。

有什么方法或解决方法可以做到这一点但我到目前为止还没有找到吗?

谢谢

您可以使用 ios 7 中介绍的后台获取 api,使用此 api 时几乎没有限制,但总的来说,这是在后台更新应用程序的好方法。限制包括但不限于仅分配 30 秒时间,电池电量不足时无法执行,大多数情况下无法设置系统决定的准确时间,有关更多信息,请阅读这些文章

http://www.appcoda.com/ios7-background-fetch-programming/

http://code.tutsplus.com/tutorials/ios-7-sdk-working-with-background-fetch--mobile-20520

http://www.devfright.com/ios-7-background-app-refresh-tutorial/

希望对您有所帮助!