“不允许”在 LocationManager 中不断记录错误
我有一个可以检查位置的应用程序。它要求用户使用位置,如果用户在菜单上说“否”,则在加载地图视图时会出现问题。
一旦我选择了地图视图,它就会再次询问用户位置。如果用户再次拒绝,我的控制台将继续显示错误/警告以及来自位置管理器类的“didFailWithError”的 NSLog。
如果用户已经拒绝,是否有办法停止 LocationManage:didFailWithErrors?如果日志文件填满我的 LocationManager,我认为 Apple 不会接受我的应用程序
这是控制台中重复的内容的示例
ERROR,Time,290362745.002,Function,"void CLClientHandleDaemonDataRegistration(__CLClient*, const CLDaemonCommToClientRegistration*, const __CFDictionary*)",server did not accept client registration 1
WARNING,Time,290362745.005,Function,"void CLClientHandleDaemonInvalidation(__CFMessagePort*, void*)",client 1035.0 has been disconnected from daemon
2010-03-15 12:19:05.002 SAQ[1035:207] LocationManager Error Denied by user
I have an app that checked for location. It asks the user to use location and if the user says no on the menu there is an issue when i load the mapview.
Once i select the mapView it asks for the user location again. If the user says no again my console keeps displaying errors/warning as well as my NSLog from the "didFailWithError" of my location Manager class.
Is there a way of stopping the LocationManage:didFailWithErrors if the user has already said no? I don't think Apple would accept my app if the Log file gets filled up my the LocationManager
Here is an example of what gets repeated in the console
ERROR,Time,290362745.002,Function,"void CLClientHandleDaemonDataRegistration(__CLClient*, const CLDaemonCommToClientRegistration*, const __CFDictionary*)",server did not accept client registration 1
WARNING,Time,290362745.005,Function,"void CLClientHandleDaemonInvalidation(__CFMessagePort*, void*)",client 1035.0 has been disconnected from daemon
2010-03-15 12:19:05.002 SAQ[1035:207] LocationManager Error Denied by user
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
关于
-didFailWithError:
方法的文档说:因此,收到此错误后,您应该向位置管理器发送消息以停止更新位置:
如果您使用 MKMapView,我认为将其
showsUserLocation
属性设置为 NO 应该可以解决问题。Documentation on
-didFailWithError:
method says:So after receiving this error you should message you location manager to stop updating location:
If you're using MKMapView I think setting its
showsUserLocation
property to NO should do the trick.您有责任检查错误代码,如果错误代码为
kCLErrorDenied
,则停止更新位置。It is your responsibility to check the error code and stop updating the location if the error code is
kCLErrorDenied
.