Is there any way to check if iOS app is in background?

后端 未结 8 918
滥情空心
滥情空心 2020-12-04 10:38

I want to check if the app is running in the background.

In:

locationManagerDidUpdateLocation {
    if(app is runing in background){
        do this
         


        
8条回答
  •  無奈伤痛
    2020-12-04 10:54

    Swift 3

        let state = UIApplication.shared.applicationState
        if state == .background {
            print("App in Background")
        }
    

提交回复
热议问题