1

我正在努力将谷歌地图放入 iPhone 应用程序中。该应用程序适用于 ipad 第 4 代、第 5 代 ipod 和 iphone。但在第 4 代设备上,如果收到 Received memory 错误警告。如下:

    2013-07-02 12:11:17.745 Maps Test[33509:907] Received memory warning.
    2013-07-02 12:28:07.112 Maps Test[33558:907] Memory Error
    2013-07-02 12:11:20.683 Maps Test[33509:907] Received memory warning.
    2013-07-02 12:28:07.112 Maps Test[33558:907] Memory Error
    2013-07-02 12:11:44.643 Maps Test[33509:907] Received memory warning.
    2013-07-02 12:28:07.112 Maps Test[33558:907] Memory Error

这些是我在一段示例代码中得到的唯一错误。
示例代码如下。

#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController{
    GMSMapView *mapView_;
}
-(void)loadView
{
    GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude: -33.86         longitude:151.20 zoom:6];
mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView_.myLocationEnabled = YES;
self.view = mapView_;
//create a marker on the map
GMSMarker *marker = [[GMSMarker alloc]init];
marker.position = CLLocationCoordinate2DMake(-33.86,151.20);
marker.title = @"Sydney";
marker.snippet = @"Australia";
marker.map = mapView_;
}
- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    NSLog(@"Memory Error");
    // Dispose of any resources that can be recreated.
}
@end

我没有收到任何级别的警告或任何其他可以让我找出问题的帮助。将地图从悉尼滚动到我当前位置后,应用程序崩溃,没有错误或任何其他提示,显示应用程序崩溃的原因。它将触发 didReceiveMemoryWarning,但由于这就是所有正在运行的东西,我还能杀死什么来让应用程序在使用地图时保持活动状态?

提前致谢!

4

0 回答 0