简体   繁体   English

iOS应用程序-从后台(?)模式定期更新

[英]ios app - regular update from background(?) mode

I want my app to run http based weather requests in the background of my app. 我希望我的应用在我的应用后台运行基于http的天气请求。 I believe I cant use push notifications because I would have to track the weather at the user specific geolocation and at some other user specific spots they follow. 我相信我不能使用推送通知,因为我必须在用户特定的地理位置以及他们关注的其他一些用户特定位置跟踪天气。 Thus it would be better if the individual app could automatically request all data itself every hour. 因此,最好是单个应用每小时可以自动请求所有数据。 Can somebody please point me into the right direction how this is solved? 有人可以指出正确的方向如何解决吗? Thanks EL 谢谢EL

For this use Background App Refresh if ur targeting ios7 and above . 为此,如果您的目标是ios7 and above使用Background App Refresh Here's a tutorial how to enable it in your app and call a method to update in background. 这是一个教程,说明如何在您的应用中启用它并调用在后台更新的方法。

Background App Refresh Tutorial 后台应用刷新教程

But you cannot control that your app automatically wakes up to fetch data every hour because background app refresh doesn't allow this to happen. 但是您无法控制自己的应用每小时自动唤醒以获取数据,因为后台应用刷新不允许这种情况发生。 The OS itself gives time to perform and execute a specific method which has been registered depending on the frequency of your app use. 操作系统本身会留出时间来执行和执行已注册的特定方法,具体方法取决于您使用应用程序的频率。 And users can also switch off background app refresh for your app in settings of iOS 用户还可以在iOS设置中为您的应用关闭后台应用刷新

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM