简体   繁体   English

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

[英]Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MKUserLocation tag]:

i just compare two values but sometime app crash. 我只是比较两个值,但有时应用程序崩溃。 How to handle it. 如何处理。

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

Map annotations contains the user location annotations as well, either check [annotation class] != [MKUserLocation class] or [annotation class] == [CustomAnnoation class] then get the tag of the annotation 地图注释也包含用户位置注释,请检查[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.

相关问题 由于未捕获的异常“ NSInvalidArgumentException”而终止应用程序,原因:“-[SWRevealViewController manifestToggel:] - Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SWRevealViewController revealToggel:] 由于未捕获的异常“ NSInvalidArgumentException”而终止应用程序,原因:“-[FBSDKProfilePictureView CGImage]: - Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FBSDKProfilePictureView CGImage]: 由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:' - [UIButton setText:] - Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIButton setText:] 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[__NSCFString isDescendantOfView:]: - Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString isDescendantOfView:]: 由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:未知的布局属性' - Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: Unknown layout attribute' 由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:NSArrayM objectForKey - Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: NSArrayM objectForKey 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[__NSCFBoolean length] - Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFBoolean length] 由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:' - [Home isEqualToString:] - Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Home isEqualToString:] 由于未捕获的异常“ NSInvalidArgumentException”而终止应用程序,原因:“-[NSDecimalNumber长度]: - Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSDecimalNumber length]: 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[FBSDKApplicationDelegate initializeSDK] - Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FBSDKApplicationDelegate initializeSDK]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM