Does CLLocationManager#startMonitoringSignificantLocationChanges prompt for user access in an iPod Touch?

StackOverflow https://stackoverflow.com/questions/16875559

質問

Since the iPod touch does not have a GPS, does it actually prompt for location access when calling CLLocationManager startMonitoringSignificantLocationChanges?

役に立ちましたか?

解決

The significant location change is only for devices with a cellular chip (iPhones, iPads with cellular). It uses the cell towers to check for significant movement.

If you try to use startMonitoringSignificantLocationChanges on an iPod Touch, it will just fail silently. It won't ever ask the users to allow location services. It won't even invoke the locationManager:didFailWithError: method.

The best thing to do it to wrap your call in a check using +significantLocationChangeMonitoringAvailable

locationManager = [[CLLocationManager alloc] init];
[locationManager setDelegate:self];
if ([CLLocationManager significantLocationChangeMonitoringAvailable]) {
    [locationManager startMonitoringSignificantLocationChanges];
} else {
    NSLog(@"Can't monitor significant location changes");
}

他のヒント

Yes.

The iPod touch can get its location by triangulating Wifi hotspots - it's still the user's location, so the user is still asked if they really want Bob's Money Stealer finding their location.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top