2012-01-09 193 views
0

这里是我的代码:应用程序崩溃时,我在iPhone SDK的使用PresentModelView

-(void)btnAction 
    { 
    mapController = [[MKMapController alloc] initWithNibName:@"MKMapController" bundle:nil]; 
mapController.delegate = self; 
mapController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; 

[self presentModalViewController:mapController animated:YES]; 
[mapController release]; 
    } 

我收到坠毁消息:

-[MKMapController respondsToSelector:]: message sent to deallocated instance 0x79ccc90 

盖伊请帮助我如何解决这个.. !

谢谢大家, Monish。

回答

0

以dealloc方式发布您的mapController

+0

当我点击该按钮时,dealloc方法应该调用并释放一些对象,如果我释放此控制器在dealloc中,当我点击按钮时不会调用dealloc方法。 – 2012-01-09 13:22:31

+0

发布您的整个.m文件,我会给你一个解决方案 – 2012-01-09 13:24:35

+0

对不起,请不要介意这里有一些安全的代码,以便我无法在这里分享它。 – 2012-01-09 13:29:04