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

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

Domanda

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

È stato utile?

Soluzione

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");
}

Altri suggerimenti

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top