"An error has occurred" message when Location Services is turned off
In the iOS simulator, I am prompted to turn on my location wh开发者_开发知识库en the app attempts to pinpoint my location. However, on an iphone running 4.1, I get a generic "An error has occurred" without any type of prompt. I checked my project's NSLogs/Alerts and none of them have a generic "An error has occurred." Is anyone aware of why this happens?
UPDATE:
This happens when a user has their location turned off. I have yet to figure out why the user is not prompted to turn it on and why - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
is not working.
The answer below solved the bug for me. This handled the error and prevents the prompt from appearing.
How to handle "Don't Allow" for location manager?
精彩评论