gpt4 book ai didi

iphone - MKMapView 因 EXC_BAD_ACCESS 崩溃

转载 作者:行者123 更新时间:2023-12-03 18:41:57 37 4
gpt4 key购买 nike

我有以下激活断点的代码行

[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

最佳答案

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

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

关于iphone - MKMapView 因 EXC_BAD_ACCESS 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4202510/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com