与 iOS Swift 中的 Android 服务等效 [英] Android Services equivalent in iOS Swift

查看:57
本文介绍了与 iOS Swift 中的 Android 服务等效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找与 Android 中的 Services 等效的东西.据我搜索,我没有发现任何有用的东西.我找到了 Background Fetch 但据我了解它不能用于长进程.
这是我想用它来做的.
从我们的 Web 服务器获取 Twitter 用户 ID 列表,然后在后台自动关注这些用户名.由于 Twitter API 存在限制,因此该过程可能需要 3-4 个小时.这可以在 iOS 上实现吗?

I am looking for something that is equivalent to Services in Android. As far as I have searched I haven't found anything useful. I found Background Fetch but according to my understanding it cannot be used long processes.
Here is what I want to use it for.
fetch a list of twitter user ids from our web server then auto-follow those usernames in background. As there are limits in Twitter API, so the process will be long possibly 3-4 hours. Is this possible on iOS?

推荐答案

iOS 中没有用于持续执行应用程序的长时间运行的后台模式.对于移动设备来说,这听起来并不是正确的任务.运行 3-4 小时的后台作业对电池寿命不利.

There is no long-running background mode for continuous execution of apps in iOS. This doesn't really sound like the right task for a mobile device. Running a 3-4 hour background job would be bad for battery life.

您可以在某处的服务器上实现该功能,并使用推送通知向设备发送更新.

You can implement the function on a server somewhere and use push notification to send updates to the device.

这篇关于与 iOS Swift 中的 Android 服务等效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆