lors d'un test sur le périphérique uniquement, j'obtiens EXC_BAD_ACCESS. Cela n'arrive pas lorsque je lance l'application. Je suis inquiet que mes utilisateurs connaîtront le crash même si je ne suis pas en train de tester. Quelqu'un a des idées pourquoi? Cela ne semble pas lié à mes annotations, car je commente l'ajout d'annotations et il se bloque toujours.MKMapView provoque EXC_BAD_ACCESS lors du test uniquement
En outre, il se charge à la première vue de la carte, mais lorsque je retourne à ma vue de collection, alors de nouveau à cette vue est quand il se bloque. Mes coordonnées semblent également valides puisqu'elles passent le contrôle de validité.
//////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//////////