iphone中presentModelViewController的堆栈溢出

问题描述 投票:1回答:2

在iPhone中启动应用程序时,我仍然面临问题。

它显示了presentModelViewController的堆栈溢出流,因为我使用了许多viewcontroller,并从其他viewcontroller调用了同一个viewcontroller,但是它被终止了。这里显示的是我在整个程序中用于调用其他视图控制器的代码]

UV_AlarmAppDelegate *app7 = (UV_AlarmAppDelegate *)[[UIApplication sharedApplication]delegate];
[self presentModalViewController:app7.frmComparisionChartLink animated:YES];
[app7 release];

仍然释放指针,但我的应用仍然被终止。

iphone objective-c cocoa-touch memory-management
2个回答
4
投票

您不应该释放应用程序委托。简而言之,除非您alloccopyretain一个对象,否则不需要释放它。


1
投票

Apple的文档显示modalPresentation这样完成;

UIViewController *uiViewController = [[UIViewController alloc] initWithNibName:@"UIViewController" bundle:nil];
uiViewController.delegate = self;

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:uiViewController];
[self presentModalViewController:navigationController animated:YES];
[navigationController release];
[uiViewController release];

希望有帮助。

© www.soinside.com 2019 - 2024. All rights reserved.