本文介绍了自定义地图注释中的警告iPhone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iPhone中为地图视图使用自定义地图注释类。每当我从导航栏堆栈弹出我的地图视图,我通常会在控制台中看到一些警告。



MapAnnotation被释放,而关键值观察者仍然注册。观察信息被泄露,甚至可能被错误地附加到其他对象上。在NSKVODeallocateBreak上设置一个断点,以便在调试器中停止。以下是当前的观察信息:



我没有在我的代码中使用KVO,因此无法了解为什么我收到这些警告

解决方案

纬度和经度有不同的界限:




  • ( - 90,90)对于Long

  • ( - 180,180)for Long



边界将导致自定义类被释放,因此给您您收到的错误。确保您正在传递纬度和经度的正确值。



如果Apple传递了一个边界错误,而不是早期版本的错误,这将是非常好的。这将节省大约5个小时的时间


I am using a custom map annotation class for map view in iPhone. Whenever I pop my map view from navigation bar stack I usually see some warnings in console.

MapAnnotation was deallocated while key value observers were still registered with it. Observation info was leaked, and may even become mistakenly attached to some other object. Set a breakpoint on NSKVODeallocateBreak to stop here in the debugger. Here's the current observation info:

I am not using KVO in my code hence not able to understand why I am receiving these warnings

解决方案

Latitude and Longitude have differing bounds:

  • (-90, 90) for Lat
  • (-180, 180) for Long

Passing a value outside of those bounds will cause the custom class to be deallocated and therefore giving you the error that you're receiving. Make sure that you are passing the correct values for both Latitude and Longitude.

It would be really nice if Apple passed a bounding error for this instead of an early release error. That would've saved me roughly 5 hours worth of time

这篇关于自定义地图注释中的警告iPhone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 02:01
查看更多