2012-02-07 55 views
3

誰能告訴我爲什麼這個代碼崩潰與SIGABRT無法識別的選擇器發送到實例,在4.3模擬器上,但在iOS 5模擬器上工作得很好嗎?PresentViewController崩潰在iOS 4.3,但不是在iOS 5

matchSetup = [[viewMatchSetup alloc]initWithNibName:@"viewMatchSetup" bundle:nil]; 
[matchSetup setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal]; 
[self presentViewController:matchSetup animated:YES completion:NULL]; 

預先感謝

FIX:[自我presentModalViewController:matchSetup動畫:YES]; // Modal is required change

回答

12

它崩潰,因爲在iOS 4.3上不提供presentViewController:animated:completion:方法UIViewController。它在iOS的5中引入既然你不使用完成塊,簡單地使用「舊」的方法presentModalViewController:animated:

[self presentModalViewController:matchSetup animated:YES]; 
+1

你可以用'respondsToSelector執行檢查:'函數 – Alexander 2012-02-07 12:38:45

+0

[自presentViewController:matchSetup動畫:是]; 哦,掛了,那也行不通。同樣的錯誤。 – Dann 2012-02-07 13:21:49

+1

[self presentModalViewController:matchSetup animated:YES] works – Dann 2012-02-07 13:42:54

相關問題