[英]Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SWRevealViewController revealToggel:]
[英]Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MKUserLocation tag]:
我只是比較兩個值,但有時應用程序崩潰。 如何處理。
NSString * markerid = [_selectedCoordinate objectForKey:@"markerid"];
for(CustomAnnotations *annotation in _mapView.annotations){
if(annotation.tag == [markerid integerValue]){
[_mapView selectAnnotation:annotation animated:NO];
return;
}
}
地圖注釋也包含用戶位置注釋,請檢查[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;
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.