MKMapView 仅在测试时导致 EXC_BAD_ACCESS
MKMapView causes EXC_BAD_ACCESS when testing only
仅在设备上测试时,我得到 EXC_BAD_ACCESS。当我只是 运行 应用程序时,不会发生这种情况。我担心我的用户会遇到崩溃,即使我没有在不测试时遇到崩溃。任何人有任何想法为什么?它似乎与我的注释无关,因为我注释掉了注释的添加并且它仍然崩溃。
此外,它会在地图的第一个视图中加载,但是当我导航回我的 collection 视图时,当它崩溃时又回到该视图。我的坐标似乎也有效,因为它通过了有效性检查。
//////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 crash.
产品 -> 编辑方案 -> 运行 -> 选项 -> 将 GPU 帧捕获设置为禁用。
仅在设备上测试时,我得到 EXC_BAD_ACCESS。当我只是 运行 应用程序时,不会发生这种情况。我担心我的用户会遇到崩溃,即使我没有在不测试时遇到崩溃。任何人有任何想法为什么?它似乎与我的注释无关,因为我注释掉了注释的添加并且它仍然崩溃。
此外,它会在地图的第一个视图中加载,但是当我导航回我的 collection 视图时,当它崩溃时又回到该视图。我的坐标似乎也有效,因为它通过了有效性检查。
//////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 crash.
产品 -> 编辑方案 -> 运行 -> 选项 -> 将 GPU 帧捕获设置为禁用。