views:

26

answers:

1

I tested my device (iPod Touch 2G iOS 4.1) if location services are enabled

permitted = [locationManager locationServicesEnabled];

and I always get a YES whether location services are enabled or not. I'm talking about the general button for location services and not the app specific button. On iPad with iOS 3.2.2 everything is working fine.

A: 

When you implement the delegate for location manager, you should be implementing didFailWithError. In there you will get the appropriate error if the user did not allow access to location

Apple Documentation States: If the user denies your application’s use of the location service, this method reports a kCLErrorDenied error. Upon receiving such an error, you should stop the location service.

Aaron Saunders
I did this but I'm talking about the general button for enabling/disabling location services (and not the extra button for each app). In addition `locationServicesEnabled` should not return YES if it is disabled.
testing
many people get confused by this, but read the documentation link I provided, it will return yes.. you have to check for the error.
Aaron Saunders
The only sentence I can find about that is in your answer. When does `locationServicesEnabled` returns NO? It does on the iPad ... The point why I am confused are `A Boolean value indicating whether location services are enabled on the device.` and `The user can enable or disable location services from the Settings application by toggling the Location Services switch in General.` So there is no difference for the general switch and the app specific switch.
testing
And the funniest thing `You should check this property before starting location updates to determine whether the user has location services enabled for the current device. If this property contains the value NO and you start location updates anyway, the Core Location framework prompts the user with a confirmation alert asking whether location services should be reenabled.` Why checking if it always returns YES and if I don't check the iOS makes it for me ...
testing