0

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

Undo
  • 25,519
  • 37
  • 106
  • 129
qnoid
  • 2,346
  • 2
  • 26
  • 45

2 Answers2

2

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");
}
nevan king
  • 112,709
  • 45
  • 203
  • 241
  • Thanks Nevan! Funny how the docs read "[..] provides tremendous power savings for applications that want to track a user’s approximate location [..]" which would immediately assume it's primarily non GPS devices. – qnoid Jun 01 '13 at 20:25
  • Yeah, the docs aren't that clear for it. But I think that it's mostly non-GPS. When the phone detects that the cell towers have changed, it triggers this. That doesn't use the GPS, just the cellular chip which is running anyway. I'm not sure if it wakes the GPS at that point to get a good fix or not. – nevan king Jun 01 '13 at 20:38
0

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.

Community
  • 1
  • 1
Undo
  • 25,519
  • 37
  • 106
  • 129
  • Is your answer based solely on this fact? Cause in my experience, on a clean iPhone 4th generation, the user is not prompted to allow for her location. Changing it to startUpdatingLocation, it works as expected. – qnoid Jun 01 '13 at 18:14
  • @qnoid I'm not sure what your comment is. It's worth noting, however, that the iPod touch doesn't allow for Geofences - if you're using those, you won't get an alert. No functionality, no alert. – Undo Jun 01 '13 at 18:16
  • No geofences at all. A CLLocationManager, assigned a delegate which will only prompt for user location on startUpdatingLocation. Have only tested it on iOS 6.1.3. – qnoid Jun 01 '13 at 18:41
  • @qnoid Check your settings to make sure that the app hasn't been granted permission before. – Undo Jun 01 '13 at 18:43