简体   繁体   English

iOS:当用户强制退出应用程序时在后台执行任务

[英]iOS : perform task in background when app is force quit by user

In iOS application, I want to upload data on server when internet available.在 iOS 应用程序中,我想在互联网可用时在服务器上上传数据。 Now problem is, if user has force quit the application then how I can re-invoke the application or can do task in background when internet is available?现在的问题是,如果用户强制退出应用程序,那么我如何重新调用应用程序或在互联网可用时在后台执行任务? Is there any possible way in iOS?在iOS中有什么可能的方法吗?

Apple is not allowing to run code after the user force quits the app.在用户强制退出应用程序后,Apple 不允许运行代码。 There are just some special rules to reactivate the app like blutooth implementation.只有一些特殊规则可以重新激活应用程序,例如蓝牙实现。 For normal server task, you just can work while the user not force quits the app.对于普通的服务器任务,您可以在用户不强制退出应用程序的情况下工作。

Edit编辑

Not even with special rules you can reactivate your app.即使有特殊规则,您也无法重新激活您的应用程序。 Bluetooth reactivation and co only works if the app gets killed by memory issues or something similiar.蓝牙重新激活和 co 仅在应用程序被内存问题或类似问题杀死时才有效。 If the user force quits the app, the app will not run until next app start.如果用户强制退出该应用程序,该应用程序将不会运行,直到下一个应用程序启动。

The iOS will give you 3mins to run a background task. iOS 会给你 3 分钟的时间来运行后台任务。 Take a look at https://medium.com/@abhimuralidharan/finite-length-tasks-in-background-ios-swift-60f2db4fa01b看看https://medium.com/@abhimuralidharan/finite-length-tasks-in-background-ios-swift-60f2db4fa01b

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

相关问题 如果用户强制退出,iOS 会在后台启动我的应用程序吗? - Will iOS launch my app into the background if it was force-quit by the user? 当app处于后台或处于终止(终止)状态时,在iOS应用中执行任务 - Perform task in iOS app when app is in background or in terminated (killed) state iOS - 当应用程序强制退出用户时处理静默推送通知 - iOS - Handling Silent Push Notifications When App Is Force-Quit By User 用户强制退出应用程序时如何处理推送通知? [iOS] - How to handle push notification when app was force-quit by user? [iOS] 当用户强行退出应用程序时处理iOS的推送通知(替代方法?) - Handling push notifications iOS when app is force-quit by user (Alternatives?) iOS:在应用程序处于后台时执行上传任务 - iOS: Perform upload task while app is in background 我们能否确定iOS应用被用户强制退出 - Can we determine that an iOS app was force quit by the user 当我强制退出 iOS 应用程序时,我的代码会发生什么? - What will happen to my code when I force quit an iOS app? 当用户进入/退出iOS中的位置区域时,在后台执行任务(代码执行/网络调用) - Perform task (code execution/ network call) in background when user enters/exits a location region in iOS 如何在iOS中检测应用程序强制退出事件 - How to detect app force quit event in iOS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM