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