locationServicesEnabled总是返回YES [英] locationServicesEnabled always return YES

查看:1025
本文介绍了locationServicesEnabled总是返回YES的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果启用了位置服务,我测试了我的设备(iPod Touch 2G iOS 4.1)。

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

permitted = [locationManager locationServicesEnabled];

我总是得到一个YES是否启用位置服务。我在说的是位置服务的常规按钮,而不是应用程序特定按钮。在iPad上使用iOS 3.2.2一切都很好。

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.

推荐答案

当你实现代理的位置管理器, didFailWithError。如果用户不允许访问位置,您将收到相应的错误

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文档状态:
如果用户拒绝您的应用程序使用位置服务,此方法报告 kCLErrorDenied 错误。收到此类错误后,您应停止位置服务。

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.

这篇关于locationServicesEnabled总是返回YES的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆