CLLocationManager 提示显示警报然后消失
这是一个可怕的错误。使用 CLLocationManger 时,无论是通过 startUpdatingLocation 或通过 ALAsset 方法访问照片的元数据,系统都会按预期提示进行位置访问...但提示一显示就会消失。我找不到原因,希望其他人也遇到过这个问题。其他警报(例如显示 UIAlertView)不会发生这种情况。
我什至可以设置目的属性,它会显示,但同样,只显示一会儿,然后它就会自行关闭。
这对我来说是一个大问题,因为我需要获得许可才能使用照片元数据。
This is one awful bug. When using CLLocationManger, either with startUpdatingLocation or with ALAsset methods to access metadata for a photo, the system is prompting for location access as expected...but the prompt disappears as soon as it's shown. I cannot find the reason for this and am hoping someone else has had this problem. This does not occur with other alerts (such as showing a UIAlertView).
I can even set the purpose property, and it displays, but again, only for a moment then it just closes itself.
This is a big issue for me as I require permission in order to use photo metadata.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否在这样的方法中创建 CLLocationManager 实例:
如果是这样,那么一旦函数退出,本地 locationManager 变量就会被清理。您应该在实例或静态变量中保存对 locationManager 的引用:
Are you creating the CLLocationManager instance in a method like so:
If so, then as soon as the function exits, the local locationManager variable is being cleaned up. You should save a reference to the locationManager either on an instance or in a static variable:
呃,现在问题似乎已经解决了。我不知道为什么或如何。
Ugh, now the issue appears to be resolved. And I don't know why or how.