即使应用程序处于后台,也可以在iOS中重复某种方法

时间:2022-07-29 02:46:50

I am developing an application that parses some data from web and puts it into a tableview. It is now working only when the user tells the app to do so (by clicking on a certain cell), but I want to change that or rather add a functionality, that would simplify user's life and parse that data (for example) every hour. I was thinking about Local notifications, because that is the only thing I am aware of that runs even when you kill the app. So the question is:

我正在开发一个从web解析一些数据并将其放入tableview的应用程序。它现在只在用户告诉应用程序这样做时(通过单击某个单元格),但我想更改它或者更确切地说添加一个功能,这将简化用户的生命并每小时解析一次该数据(例如) 。我正在考虑本地通知,因为即使你杀了应用程序,这是我所知道的唯一运行。所以问题是:

Is it possible to repeat a certain method or functionality in an app till (for example)the user disables this option? Is there something like a service that is running even when the application is in the background or even killed?

是否可以在应用程序中重复某种方法或功能,直到(例如)用户禁用此选项?即使应用程序在后台甚至被杀死,是否有类似服务的东西在运行?

Can this be done by a local notification? How?

这可以通过本地通知来完成吗?怎么样?

Or what is the appropriate way to do it?

或者做到这一点的适当方法是什么?

Thank you

谢谢

1 个解决方案

#1


1  

Is there something like a service that is running even when the application is in the background

即使应用程序在后台运行,也会运行类似服务的东西

See, for example:

例如,见:

Running iOS App In The Background

在后台运行iOS应用程序

Your app can run in the background only if it is performing certain permitted kinds of activity.

您的应用只有在执行某些允许的活动时才能在后台运行。

#1


1  

Is there something like a service that is running even when the application is in the background

即使应用程序在后台运行,也会运行类似服务的东西

See, for example:

例如,见:

Running iOS App In The Background

在后台运行iOS应用程序

Your app can run in the background only if it is performing certain permitted kinds of activity.

您的应用只有在执行某些允许的活动时才能在后台运行。