Locationservice Indicator stays “on”

前端 未结 4 1145
灰色年华
灰色年华 2020-12-15 11:57

I have a created a small app which uses location services on the iPhone. All works well, except the fact, that sometimes, the small arrow in the info-bar stays active even i

4条回答
  •  清歌不尽
    2020-12-15 12:24

    I met a similar problem. The problem only happens on iPhone4, but works perfect on my 3GS. After looking into my code, I found that in my startUpdatingLocation method I used startUpdatingLocation and startMonitoringForRegion services, however, in my stopUpdatingLocation method I just stop updatingLocation service. I fixed this issue by turning off MonitoringForRegion as well.

    #pragma mark -
    #pragma mark Location methods
    - (void)startUpdatingLocation
    {
    
        [self.locationManager startUpdatingLocation];
    
        [self.locationManager startMonitoringForRegion:desRegion desiredAccuracy:50.0f];
    }
    
    - (void)stopUpdatingLocation
    {
        [self.locationManager stopUpdatingLocation];
    
            //  !!!: fix location service indicator stuck issue
        [self.locationManager stopMonitoringForRegion:desRegion];
    }
    

提交回复
热议问题