OGeek|极客世界-中国程序员成长平台

标题: ios - swift : how to run a function even when user kills the app [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 09:50
标题: ios - swift : how to run a function even when user kills the app

我在 iOS9 上使用 swift 2 和 Xcode7。我想知道即使用户杀死应用程序,我是否可以保持“永远”运行的功能(检查要删除的内容)?

我正在根据一些规则和时间从联系人列表中删除联系人。它运行正常,但只是在打开应用程序或在第二个计划中。我想让这个应用程序能够在用户杀死它时删除这些联系人。



Best Answer-推荐答案


当用户打开应用程序时,您可以使用后台线程。但是如果应用程序将被终止,则没有运行功能的选项。 在此处查找应用程序生命周期并重新设计您的架构:https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/TheAppLifeCycle/TheAppLifeCycle.html

关于ios - swift : how to run a function even when user kills the app,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33900590/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4