次の方法でメモリリークが発生しない方法を理解しようとしています。Aが割り当てられますが、 or呼び出しUIPopoverController
を含めると、アプリケーションがクラッシュし、メッセージが表示されます。autorelease
release
'-[UIPopoverController dealloc] reached while popover is still visible.'
-(void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control {
[mapView deselectAnnotation:view.annotation animated:TRUE];
if ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ) {
UIViewController *con = [[UIViewController alloc] init];
UIPopoverController *poc = [[UIPopoverController alloc] initWithContentViewController:con];
[con release];
poc.popoverContentSize = CGSizeMake( 320, 320 );
[poc presentPopoverFromRect:view.bounds inView:view permittedArrowDirections:UIPopoverArrowDirectionAny animated:TRUE];
}
else {
; // TODO (miked): display stuff another way
}
}
これは、基本的なメモリ管理の慣行に反しているようです。
ps ARC を有効にしていません。