简体   繁体   English

关闭位置服务时出现“发生错误”消息

[英]“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. 在iOS模拟器中,当应用程序尝试精确定位我的位置时,系统会提示我打开我的位置。 However, on an iphone running 4.1, I get a generic "An error has occurred" without any type of prompt. 但是,在运行4.1的iPhone上,我得到一个通用的“发生错误”,而没有任何类型的提示。 I checked my project's NSLogs/Alerts and none of them have a generic "An error has occurred." 我检查了项目的NSLogs / Alerts,但它们都没有通用的“发生错误”。 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. 我还没有弄清楚为什么没有提示用户打开它以及为什么- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error无法正常工作。

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? 如何处理位置管理器的“不允许”?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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