“不允许”在 LocationManager 中不断记录错误

发布于 2024-08-25 01:04:30 字数 732 浏览 13 评论 0原文

我有一个可以检查位置的应用程序。它要求用户使用位置,如果用户在菜单上说“否”,则在加载地图视图时会出现问题。

一旦我选择了地图视图,它就会再次询问用户位置。如果用户再次拒绝,我的控制台将继续显示错误/警告以及来自位置管理器类的“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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

能怎样 2024-09-01 01:04:30

关于 -didFailWithError: 方法的文档说:

如果用户拒绝您的应用程序
使用定位服务,这
方法报告 kCLErrorDenied 错误。
收到此类错误后,您
应停止定位服务。

因此,收到此错误后,您应该向位置管理器发送消息以停止更新位置:

[manager stopUpdatingLocation];

如果您使用 MKMapView,我认为将其 showsUserLocation 属性设置为 NO 应该可以解决问题。

Documentation on -didFailWithError: method says:

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.

So after receiving this error you should message you location manager to stop updating location:

[manager stopUpdatingLocation];

If you're using MKMapView I think setting its showsUserLocation property to NO should do the trick.

昨迟人 2024-09-01 01:04:30

您有责任检查错误代码,如果错误代码为 kCLErrorDenied,则停止更新位置。

It is your responsibility to check the error code and stop updating the location if the error code is kCLErrorDenied.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文