2017-08-08 52 views
0

我有ViewController。我試圖顯示一個警報。我以前使用折舊UIAlertView。我嘗試使用UIViewController。我收到以下錯誤 「爲視圖控制器沒有可視界面聲明部門presentViewController」 - 這發生在沒有可見的ViewController接口聲明扇區presentViewController

[self presentViewController: 

我的視圖控制器.H包括:

@interface VC : UIViewController 

我的視圖控制器。 m具有以下代碼:

UIAlertController* alertError = [UIAlertController alertControllerWithTitle:@"Error" message:output 
                        preferredStyle:UIAlertControllerStyleAlert]; 

         UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault 
                      handler:^(UIAlertAction * action) {}]; 

         [alertError addAction:defaultAction];       

         [self presentViewController: alertError animated:Yes competion:nil]; 

我錯過了什麼?

+0

的名字叫做'VC'或'ViewController'類?你能否將實際的錯誤粘貼到你的問題中,而不是你的描述中? –

+0

類是VC - 沒有可見@interface for'VC'聲明選擇器presentviewController:animated:completion' – Jon

+0

如果這是真正的錯誤消息,'presentviewController'應該是'presentViewController'。 –

回答

0

可謂是一個O型在.M 感謝您的幫助

+0

[self presentViewController:alertError animated:「YES」competion:nil]; – Jon

相關問題