gpt4 book ai didi

ios - 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[MKUserLocation标记]:

转载 作者:行者123 更新时间:2023-12-01 19:48:12 25 4
gpt4 key购买 nike

我只是比较两个值,但有时应用程序崩溃。如何处理。

NSString *  markerid = [_selectedCoordinate objectForKey:@"markerid"];
for(CustomAnnotations *annotation in _mapView.annotations){
if(annotation.tag == [markerid integerValue]){
[_mapView selectAnnotation:annotation animated:NO];
return;
}
}

最佳答案

map 注释还包含用户位置注释,请检查[annotation class] != [MKUserLocation class][annotation class] == [CustomAnnoation class],然后获取注释的标签

NSString *  markerid = [_selectedCoordinate objectForKey:@"markerid"];
for(CustomAnnotations *annotation in _mapView.annotations){
if([annotation class] != [MKUserLocation class]) {
if(annotation.tag == [markerid integerValue]) {
[_mapView selectAnnotation:annotation animated:NO];
return;
}
}
}

关于ios - 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[MKUserLocation标记]:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47410792/

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