2014-11-14 82 views
0

在故事板中,我的主菜單上有一個名爲showCountdownViewControllerPressed的按鈕。呈現XIB視圖凍結

這個按鈕應該顯示我的XIB叫做TimerViewController。

但是,當我運行該應用程序,它凍結按鈕按下,然後一段時間後崩潰的應用程序。

我把這個動作在我CRViewController.m(我的主菜單)[我也有進口TimerViewController.h在此文件]

- (IBAction)showCountdownViewControllerPressed:(id)sender { 
    NSLog(@"showTimerViewController"); 
    TimerViewController *timeController = [[TimerViewController alloc] 
            initWithNibName:@"TimerViewController" bundle:nil]; 
    [self presentViewController:timeController animated:YES completion:nil]; 

CRViewController Countdown Clock Button XIB TimerViewController Memory TimerViewController Make-up Breakpoint Exceptions

+0

你得到了什麼錯誤? – iBhavin

+0

這就是奇怪的事情,我沒有得到任何錯誤。它只是說Xcode意外退出。當我在測試設備上運行它時,它會凍結,然後崩潰。然而,我得到了NSLog聲明。 –

+0

'TimeViewController'的內容是什麼,看起來內存使用率太高,在這種情況下應用程序可能會崩潰。 – gabbler

回答

0

這不是你的問題的答案,但它可以提供幫助。我把它放在這裏,因爲我不能在評論中添加圖片。您可以在breakpoints選項卡的底部放置一個異常斷點,通常它會在崩潰之前停止,您將獲得更多關於它的信息。

enter image description here

帖子裏的異常斷點它停下來獲得更多的幫助:)

+0

之上添加了以下圖片 –

+0

您是否試圖用[NSBundle mainBundle]而不是nil初始化TimeViewController? – diegomen

+0

不,那看起來怎麼樣? –

0

嘛,如果是風景而已,你可以在TimerViewController爲iOS 8添加這個,這將使得TimerViewController旋轉到景觀模式。

- (BOOL)shouldAutorotate 
{ 
    return YES; 
} 

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { 
    return UIInterfaceOrientationLandscapeLeft; 
} 
+0

仍然沒有解決,但謝謝! –