iOS8: Blue bar “is Using Your Location” appears shortly after exiting app

后端 未结 6 1184
慢半拍i
慢半拍i 2020-12-25 10:40

I would like to get the blue bar when tracking in the background, but not when not.

My app uses location services all the time when active, so in iOS8 I use the

6条回答
  •  再見小時候
    2020-12-25 11:25

    To show blue bar on header that your app is using location when pressing home button you have to set Privacy - Location When In Use Usage Description in Plist file

     self.locationManager.delegate = self;
    
     locationManager.desiredAccuracy = kCLLocationAccuracyBest
    
     self.locationManager.requestWhenInUseAuthorization()
    
     self.locationManager.pausesLocationUpdatesAutomatically = true
    
     self.locationManager.allowsBackgroundLocationUpdates = true
    

    when you use self.locationManager.requestAlwaysAuthorization() then it will not display blue header

    you need only use self.locationManager.requestWhenInUseAuthorization() then it will display blue header when you app is in background that your app is using Location

    you have to also set background mode in capabilities in target for location

提交回复
热议问题