当测试时,MKMapView导致EXC_BAD_ACCESS [英] MKMapView causes EXC_BAD_ACCESS when testing only

查看:316
本文介绍了当测试时,MKMapView导致EXC_BAD_ACCESS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

仅在设备上进行测试时,我将获得EXC_BAD_ACCESS。当我运行应用程序时,这不会发生。我担心我的用户会遇到崩溃,即使我不是没有测试。任何人都有什么想法为什么?它与我的注释似乎没有任何关系,因为我注释了添加注释,它仍然崩溃。

when testing on device only, i am getting EXC_BAD_ACCESS. This does not happen when i just run the app. I am concerned my users will experience the crash even though i am not when not testing. Anyone have any ideas why? It does not seem related to my annotations, as i comment out the adding of annotations and it still crashes.

另外,它加载在地图的第一个视图上,但是当我导航回我的收藏视图,那么返回到这个视图是崩溃。我的坐标似乎是有效的,因为它通过了有效性检查。

Also, it loads on first view of the map, but when i navigate back to my collection view , then back to this view is when it crashes. My coordinates also seem valid since it passes the validity check.

        //////THIS IS ALL THE MAP VIEW STUFF......
        self.mapView.delegate = self;
        self.mapView = [[MKMapView alloc] initWithFrame:CGRectMake(17, 650, 733, 300)];
        self.mapView.scrollEnabled = NO;
        self.mapView.zoomEnabled = NO;
        self.mapView.showsUserLocation = YES;

        CLLocationCoordinate2D location;                         
        NSMutableArray *newAnnotations = [NSMutableArray array]; 
        MKPointAnnotation *newAnnotation;                        

        location.latitude = [[_selectedCategoryItem objectForKey:@"latitude"]doubleValue];
        location.longitude = [[_selectedCategoryItem objectForKey:@"longitude"]doubleValue];

        NSLog(@"Latitude ==> %f", [[_selectedCategoryItem objectForKey:@"latitude"]doubleValue]);
        NSLog(@"Longitude ==> %f", [[_selectedCategoryItem objectForKey:@"longitude"]doubleValue]);

        newAnnotation = [[MKPointAnnotation alloc] init];
        newAnnotation.coordinate = location;

        MKCoordinateRegion region;
        MKCoordinateSpan span;
        span.latitudeDelta = 0.10;
        span.longitudeDelta = 0.10;
        region.span = span;
        region.center = location;

        if (CLLocationCoordinate2DIsValid(location)) {

            NSLog(@"place has VALID coordinates");
            [newAnnotations addObject:newAnnotation];
            [self.mapView addAnnotations:newAnnotations];

        } else {

            NSLog(@"place has INVALID coordinates");
        }

        [self.mapView setRegion:region animated:TRUE];
        [self.m_ScrollView addSubview:self.mapView];

        /////END ALL THE MAP VIEW STUFF//////////


推荐答案

我在这个问题上发现了解决我问题的答案。 UIWebView EXC_BAD_ACCESS崩溃

I found on this question the answer which solved my problem. UIWebView EXC_BAD_ACCESS crash.

产品 - >编辑方案 - >运行 - >选项 - >将GPU帧捕获设置为禁用。

Product -> Edit Scheme -> Run -> Options -> Set GPU Frame Capture to Disabled.

这篇关于当测试时,MKMapView导致EXC_BAD_ACCESS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆