objective-cで[Google Maps SDK for iOS] メモリリークが発生します。

フォーラム(掲示板)ルール
フォーラム(掲示板)ルールはこちら  ※コードを貼り付ける場合は [code][/code] で囲って下さい。詳しくはこちら
ERIZA

objective-cで[Google Maps SDK for iOS] メモリリークが発生します。

#1

投稿記事 by ERIZA » 10年前

BtnViewControllerでボタンをタップして画面繊維を行った後、BtnViewControllerの画面に戻ると、メモリリークが発生します。

最初の設定などは公式サイトに書かれている通りに行いました。↓リンク
https://developers.google.com/maps/docu ... /ios/start

コードは下記の通りに成ります。解放するべき所が解る方ぜひお願いします。

BtnViewController.m
- (IBAction)MapviewSelect:(id)sender {
MapViewController *mapViewController = [[MapViewController alloc] initWithNibName:@”MapViewController” bundle:nil];
[self.navigationController pushViewController:mapViewController animated:TRUE];
}

MapViewController.m

GMSMapView *_mapView;
CLLocationManager *_locationManager;

- (void)viewDidLoad{
[super viewDidLoad];
// 地図の表示
_mapView = [GMSMapView mapWithFrame:CGRectMake(0, 0, 320, 460) camera:[GMSCameraPosition cameraWithLatitude:-33.86 longitude:151.20 zoom:6]];
[self.view addSubview:_mapView];
// 戻るボタンの生成
UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
btn.frame = CGRectMake(10, 10, 100, 30);
[btn addTarget:self action:@selector(buttonTap:) forControlEvents:UIControlEventTouchDown];
[self.view addSubview:btn];
}
-(void)buttonTap:(UIButton*)button{
[self.navigationController popViewControllerAnimated:TRUE];
}
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[_mapView startRendering];
}
- (void)viewWillDisappear:(BOOL)animated{
[_mapView stopRendering];
[_mapView clear];
_mapView = nil;
[super viewWillDisappear:animated];
}

“C言語何でも質問掲示板” へ戻る