2012-02-22 61 views
0

当我点击后退按钮时,我的iPhone应用程序崩溃。我真的不知道为什么会发生这种情况。您可以在图片中看到我的应用程序崩溃的位置。 Image of Xcode当前往ViewController时,应用程序崩溃

我已经检查过我的按钮只与一个动作连接。所以我不知道到底是什么问题。

如果我的问题愚蠢然后PLZ原谅我,我是新iPhone的发展,请帮助我使用与设备打印机

传染,我认为有一些问题

CAGradientLayer *gradient = [CAGradientLayer layer]; 
gradient.colors = [NSArray arrayWithObjects:(id)[[UIColor colorWithRed:0.8 green:0.8 blue:1 alpha:1] CGColor],(id)[[UIColor colorWithRed:0.05 green:0.05 blue:0.38 alpha:255] CGColor], nil]; 

//creating the iEpsonCom objects 
m_deviceParams = [[DeviceParameters alloc] init]; 
m_device = [[Device alloc] init]; 

//registering the callback 
[m_device registerCallback:self withSelector:@selector(callbackMethod:)]; 

//creating a thread for regularly checking the connection state 
m_Thread = [[ThreadClass alloc] init]; 
[m_Thread registerCallback:self withSelector:@selector(connectionStateThreadCallbackMethod:)]; 
[m_Thread setMilliseconds:300]; //check the connection state every 300 ms 
[m_Thread start];    //start the thread 
+0

你正在解雇的viewController的dealloc方法中发生了什么?也许你正在过度放松一些东西。 – Alexander 2012-02-22 14:12:08

+0

如果你发布一些你设置显示/放弃这个viewController的代码,它也会有所帮助。 – 2012-02-22 14:16:20

+0

Thanx回复,我释放我dealloc中的对象,但我评论了所有的对象释放,但它仍然崩溃 – Mashhadi 2012-02-23 07:29:31

回答

3

这可能是你以前的视图控制器是否丢失,所以首先检查,你想弹出的控制器仍然在视图控制器堆栈中?

NSArray *arrView = [self.navigationController viewControllers]; 
NSLog(@"arrView %@",arrView); 

如果您不能看到要在该堆栈中弹出的视图控制器,则可能是您需要保留控制器。您可能还会释放太多,例如在dealloc方法中。