MKMapView 因 EXC_BAD_ACCESS 崩溃

发布于 2024-10-02 17:03:42 字数 1119 浏览 0 评论 0原文

我有以下代码行激活断点

[mapView addAnnotations:grabinstance.itemArray];

此随机崩溃。 rabinstance.itemArray 始终被完全填充,并且当时永远不会改变,因为只有在数组已满时才会调用这段代码。这次已确认数组中有 323 个项目。

NSZombieEnabled 也没有找到任何东西。

下面是回溯,上面的行是 1154 行。

#0  0x0126a372 in _insert ()
#1  0x0126a312 in _splitNode ()
#2  0x0126a3b7 in _insert ()
#3  0x011db253 in -[MKAnnotationContainerView addAnnotation:] ()
#4  0x011dfc2e in -[MKAnnotationContainerView addAnnotations:] ()
#5  0x011b0b30 in -[MKMapView addAnnotations:] ()
#6  0x00009257 in -[BigViewController plotItems] (self=0x614de90, _cmd=0x16464f) at /Users/zzzz/Documents/iPhone Projects/BigProject/Classes/BigViewController.m:1154
#7  0x005336c1 in _nsnote_callback ()
#8  0x01c18f99 in __CFXNotificationPost_old ()
#9  0x01b9833a in _CFXNotificationPostNotification ()
#10 0x00529266 in -[NSNotificationCenter postNotificationName:object:userInfo:] ()
#11 0x00024071 in -[ItemGrabber parserDidEndDocument:] (self=0x617b540, _cmd=0x689aa3, parser=0xf6b4ab0) at /Users/zzzz/Documents/iPhone Projects/BigProject/Classes/ItemGrabber.m:267

I have the following line of code which activates the breakpoint

[mapView addAnnotations:grabinstance.itemArray];

This crashing randomly. grabinstance.itemArray is fully populated always and is never changing at the time due to this bit of code only being called once the array is full. This particular time this was confirmed as 323 items in the array.

NSZombieEnabled doesn't find anything at all either.

The backtrace is below and line 1154 is the line above.

#0  0x0126a372 in _insert ()
#1  0x0126a312 in _splitNode ()
#2  0x0126a3b7 in _insert ()
#3  0x011db253 in -[MKAnnotationContainerView addAnnotation:] ()
#4  0x011dfc2e in -[MKAnnotationContainerView addAnnotations:] ()
#5  0x011b0b30 in -[MKMapView addAnnotations:] ()
#6  0x00009257 in -[BigViewController plotItems] (self=0x614de90, _cmd=0x16464f) at /Users/zzzz/Documents/iPhone Projects/BigProject/Classes/BigViewController.m:1154
#7  0x005336c1 in _nsnote_callback ()
#8  0x01c18f99 in __CFXNotificationPost_old ()
#9  0x01b9833a in _CFXNotificationPostNotification ()
#10 0x00529266 in -[NSNotificationCenter postNotificationName:object:userInfo:] ()
#11 0x00024071 in -[ItemGrabber parserDidEndDocument:] (self=0x617b540, _cmd=0x689aa3, parser=0xf6b4ab0) at /Users/zzzz/Documents/iPhone Projects/BigProject/Classes/ItemGrabber.m:267

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

饮惑 2024-10-09 17:03:42

您应该使用CLLocationCooperative2DIsValid()检查您的注释:

if (CLLocationCoordinate2DIsValid(place.coordinate)) {
    [_mapView addAnnotation:place];
} else {
    NSLog(@"place %@ has invalid coordinates", place.name);
}

You should check your annotations using CLLocationCoordinate2DIsValid():

if (CLLocationCoordinate2DIsValid(place.coordinate)) {
    [_mapView addAnnotation:place];
} else {
    NSLog(@"place %@ has invalid coordinates", place.name);
}
只是我以为 2024-10-09 17:03:42

向 Apple 报告的错误并已得到承认

Bug reported to Apple and as been acknowledged

夕嗳→ 2024-10-09 17:03:42

我也遇到了同样的问题,我修复了它,问题出在我的位置上,数组中的对象可能不包含有效位置,它们可能是垃圾值

I also had the same problem and i fixed it,The problem was with my locations,The objects in the array may not contain valid locations,They may be garbage values

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