2012-02-07 82 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