简体   繁体   English

如何知道哪些应用程序在后台

[英]How to know which Apps are in the background

是否有可能知道后台有哪些应用程序(双击主屏幕按钮时出现的那些应用程序)?

For 3rd party apps, no. 对于第三方应用程序,否。 Not in a reliable, App Store safe, future proof way. 没有以可靠的,App Store安全的,面向未来的方式。 Think of your app as siloed, unaware of what else is running, and you'll be pretty much in the mindset Apple want (and try to technically enforce). 将您的应用视为孤立无用的,不知道还有其他正在运行的应用,并且您会在苹果想要的思维定势中(并尝试从技术上实施)。

For other apps developed by you, you can use shared containers to write load/unload data each time one of your apps opens/closes, and work out what's currently running. 对于您开发的其他应用程序,可以在每次打开/关闭一个应用程序时使用共享容器写入加载/卸载数据,并确定当前正在运行的内容。

This is not possible on iOS with public api. 在带有公共API的iOS上这是不可能的。 There might be private api calls that do this, even though I don't think you will have access to them while running in the sandbox. 即使我不认为您在沙盒中运行时也无法访问它们,但可能会有私有api调用执行此操作。 This however might be possible on jailbroken devices, but you will not be able to submit to the app store with such api usage, unless you know how to hide that from apple. 但是,这可能在越狱设备上是可能的,但是除非您知道如何将其隐藏在苹果中,否则您将无法使用此类api提交到应用商店。

Also please note that apps shown in the app switcher are not necessarily running. 另请注意,应用程序切换器中显示的应用程序不一定正在运行。 The app switcher shows every app that has been running in the past which the user didn't force-quit. 应用切换器会显示过去用户没有强制退出的所有已运行应用。 If the user does not force quit an app, every app that has ever been launched is shown in the app switcher. 如果用户不强制退出某个应用程序,则在应用程序切换器中会显示曾经启动的每个应用程序。 If iOS decides to terminate an app because of memory needs, the app is still shown in the app switcher. 如果iOS由于内存需求而决定终止应用程序,则该应用程序仍会显示在应用程序切换器中。 This is one of the reasons why everyone should implement state restoration, as the user does not know whether an app is currently running or not! 这是每个人都应执行状态还原的原因之一,因为用户不知道应用程序当前是否正在运行!

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

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