有什么方法可以检查iOS应用是否在后台? [英] Is there any way to check if iOS app is in background?
本文介绍了有什么方法可以检查iOS应用是否在后台?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要检查应用程序是否在后台运行.
I want to check if the app is running in the background.
在:
locationManagerDidUpdateLocation {
if(app is runing in background){
do this
}
}
推荐答案
应用程序委托获取指示状态转换的回调.您可以基于此进行跟踪.
App delegate gets callbacks indicating state transitions. You can track it based on that.
applicationState 属性会返回当前状态.
Also the applicationState property in UIApplication returns the current state.
[[UIApplication sharedApplication] applicationState]
这篇关于有什么方法可以检查iOS应用是否在后台?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文