应用程序在iOS6上使用MapKit崩溃

Mar*_*ida 6 crash scrollview mapkit ios6 ios6-maps

我的专用于iPad的应用程序中的谷歌地图有一个奇怪的问题(使用iOS6).我做了一个水平滚动视图,里面有两个视图.一个是详细信息视图(一些文本,没什么特别的),第二个视图是一个带谷歌地图的视图控制器.这是我的应用程序中的通用方案(从两个视图构建scrollview),用于几个不同的目的.当我开始在iOS6的真实iPad上测试应用程序时会出现问题.应用程序应该查看滚动视图时崩溃.但不是立即的.开始时,可​​以正确查看滚动视图.然后我想用新数据构建一个新的滚动视图.它也很好,滚动视图可以正常查看.经过几次这样的操作后,我开始收到越来越多的错误日志,如下所示:

failed to make complete framebuffer object 8cdd

在几次scrollView运行之后,应用程序崩溃而没有任何其他错误.代码编辑器指向main.m文件,以及以下行:

int retVal = UIApplicationMain(argc, argv, nil, nil);

请指导我找出我做错了什么.我的视图控制器中负责查看谷歌地图的viewDidLoad方法在哪里:

-(void)viewDidLoad {
mapView.mapType = MKMapTypeSatellite;
mapView.showsUserLocation = YES; 

/* ANNOTATION (pin) */

CLLocationCoordinate2D annotationCoord;

annotationCoord.latitude = [self.restaurant.latitude doubleValue];
annotationCoord.longitude = [self.restaurant.longitude doubleValue];

// a pin with the info. 

MKPointAnnotation *annotationPoint = [[MKPointAnnotation alloc] init];

annotationPoint.coordinate = annotationCoord;
annotationPoint.title = self.restaurant.name;

// add annotation to the map

    [mapView performSelectorOnMainThread:@selector(addAnnotation:)
                                  withObject:annotationPoint
                                  waitUntilDone:YES];


[annotationPoint release];  

MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance (annotationCoord, 500, 500); 
[self.mapView setRegion:region animated:YES];

[super viewDidLoad];
}
Run Code Online (Sandbox Code Playgroud)

并且没有关于我如何将视图控制器与谷歌地图推送到视图.它总是崩溃我的应用程序:(.我试过这样:

[scrollView addSubview:self.googleMapViewController.view]; 
Run Code Online (Sandbox Code Playgroud)

或者那个:

[[self navigationController] pushViewController:self.googleMapViewController animated:YES];
Run Code Online (Sandbox Code Playgroud)

当我在模拟器上运行应用程序时,一切都很好.我正在使用XCode 4.5.1.

小智 0

我在我的一个项目中遇到了同样的问题。这是由内存泄漏引起的。如果不删除地图视图,它们会消耗大量内存。它不会出现在模拟器上,因为计算机可以使用更多内存。只要确保在不再需要地图视图时将其删除即可。我还建议使用 Instruments (Leaks) 运行该应用程序 - 在这种情况下它是一个非常有用的工具。