0

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//////////
mreynol
  • 309
  • 3
  • 17

1 Answers1

4

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

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

Community
  • 1
  • 1
mreynol
  • 309
  • 3
  • 17