GPS 应用程序在 iOS 5 上停止工作 - 位置管理器未更新
我开发了一个针对 iOS 4.3 的应用程序。效果很好。但自从我迁移到 iOS 5.0 以来,该应用程序开始表现出奇怪的行为。位置管理器不显示位置变化的更新。有人遇到过这种问题吗?
感谢您的任何帮助。
I have developed an app targeted for iOS 4.3. It worked fine. But since I migrated to iOS 5.0, the app has started showing strange behavior. The location manager is not showing updates on change in position. Has anyone encountered this kind of problem?
Thanks for any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我与 CLLocation 经理共享票价,出现奇怪的更新问题
从 iOS 4.x 迁移到 5 时:
您是否对 CLLocationManager 对象进行了子类化?
问题:
在这种情况下,有时委托方法有时
不要被呼叫(例如 didUpdateLocation)。
修复:不要子类化 CLLocationManager
单例对象在 4.x 中工作正常,但在 iOS5 中不一致
来自主线程,因此您会遇到奇怪的行为。
无需子类化它。 (事实证明,即使在越狱的 iPhone 上,该解决方案也效果最佳)
。如果您的设计与情况 2 类似,您仍然可以使用从单例指向其实例的动态属性。
希望这有帮助:)
I had my fare share with CLLocation manager weird updating issues
when moving from iOS 4.x to 5:
Have you subclassed the CLLocationManager object ?
problem :
In that case sometime the delegate methods sometime
don't get called (ex. didUpdateLocation).
fix: don't subclass CLLocationManager
of a singleton object worked fine in 4.x but was inconsistent in iOS5
from the main thread and so you experience the strange behavior.
without subclassing it . (this solution proved to work best , even on jailbroken iphones)
. you can still use a dynamic property pointing to it's instance from the singleton if you design is similar to case 2.
Hope this helps :)
iOS 5 处理内存管理的方式可能是一种方式。如果您在 .h 文件中声明变量并且没有正确或隐式引用它 [self.myVar doSomething];它可能会在你不知情的情况下倾倒在你身上。它仍然可以正常编译,但主要会被忽略和忽略。
没有看到代码就不是 100%,但当 iOS 5 到来时,我也注意到了我们公司的一些旧程序的这个问题。祝你好运。
The way iOS 5 handles memory management could be one way. If you are declaring a variable in your .h file and not referencing it correctly or implicitly [self.myVar doSomething]; it could be dumping out on you without you knowing it. It will still compile fine, but will mainly be ignored and passed over.
Not 100% without seeing code, but I have noticed this issue as well with some of our company's older programs when iOS 5 came calling. Good luck.
另外,如果您感兴趣,我从这里获取了此信息,它是专门为 iOS 5 制作的: http://www.techotopia.com/index.php/Getting_iPhone_Location_Information_using_the_iOS_5_Core_Location_Framework
Also in case you were interested I got this information from here and it is made specifically for iOS 5: http://www.techotopia.com/index.php/Getting_iPhone_Location_Information_using_the_iOS_5_Core_Location_Framework
在缓存位置的应用程序中遇到间歇性问题。有时,位置服务返回位置的时间比预期要长,而是返回最后缓存的位置。请参阅 这个 iOS 文档示例,使用
howRecent
变量来过滤掉可能缓存的位置。为了防止 Apple 更改其 URL,此处列出了相关的委托方法:
这实际上会忽略任何早于 15 秒的位置。我们在应用中将间隔设置为
5.0
,但您必须进行试验才能知道哪种方法最适合您。Ran into an intermittent problem in an app where the location was cached. Sometimes location services takes longer than expected to return a location, and instead it returns the last cached location. See this iOS documentation example that uses a
howRecent
variable to filter out locations that are likely cached.Just in case Apple changes their URL, the relevant delegate method is listed here:
This effectively ignores any locations older than 15 seconds. We set the interval to
5.0
in our app, but you'll have to experiment to see what works well for you.