简体   繁体   中英

“An error has occurred” message when Location Services is turned off

In the iOS simulator, I am prompted to turn on my location when 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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM