2012-02-22 60 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方法中。