我根据苹果文档使用post iOS4方法startMonitoringSignificantLocationChanges方法:
For applications that do not need a regular stream of location events, consider using the startMonitoringSignificantLocationChanges method to start the delivery of events instead. This method is more appropriate for the majority of applications that just need an initial user location fix and need updates only when the user moves a significant distance. This interface delivers new events only when it detects changes to the device’s associated cell towers, resulting in less frequent updates and significantly lower power usage.
因此,此接口仅在检测到位置更改时才会发送新事件,我可以使用哪种方法来检测位置是否已显着更改,到目前为止,我是这样的:
if ([CLLocationManager significantLocationChangeMonitoringAvailable]) {
[locationManager startMonitoringSignificantLocationChanges];
}
我应该使用什么显式方法来明确检测位置是否已显着更改。感谢名单。
答案 0 :(得分:1)
我这样做:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customizatio-n after application launch.
id locationValue = [launchOptions objectForKey:UIApplicationLaunchOptionsLocationKey];
if (locationValue)
{
// create a new manager and start checking for sig changes
[self log:@"didFinishLaunchingWithOptions location key"];
m_locManager = [[CLLocationManager alloc] init];
[self log:@"didFinishLaunchingWithOptions created manager"];
m_locManager.delegate = self;
[self log:@"didFinishLaunchingWithOptions set delegate"];
[m_locManager startMonitoringSignificantLocationChanges];
[self log:@"didFinishLaunchingWithOptions monitoring sig changes"];
return YES;
}
[self log:@"didFinishLaunchingWithOptions"];
return YES;
}
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation