if ([CLLocationManager significantLocationChangeMonitoringAvailable])
{
// Stop normal location updates and start significant location change updates for battery efficiency.
[[GlobalVariables locationManager] stopUpdatingLocation];
[[GlobalVariables locationManager] startMonitoringSignificantLocationChanges];
}
else
{
NSLog(@"Significant location change monitoring is not available.");
}
在applicationDidBecomeActive 中加入
if ([CLLocationManager significantLocationChangeMonitoringAvailable])
{
// Stop significant location updates and start normal location updates again since the app is in the forefront.
[[GlobalVariables locationManager] stopMonitoringSignificantLocationChanges];
[[GlobalVariables locationManager] startUpdatingLocation];
}
else
{
NSLog(@"Significant location change monitoring is not available.");
}