PresentViewController在iOS 4.3上崩溃,但在iOS 5上没有

前端之家收集整理的这篇文章主要介绍了PresentViewController在iOS 4.3上崩溃,但在iOS 5上没有前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
任何人都可以告诉我为什么这个代码崩溃与SIGABRT无法识别的选择器发送到实例,在4.3模拟器上,但在iOS 5模拟器上工作得很好?

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

提前致谢

FIX:[self presentModalViewController:matchSetup animated:YES]; //模态是必需的更改

解决方法

它崩溃了,因为iOS 4.3上没有UIViewController的presentViewController:animated:completion:方法.它是在iOS 5中引入的.既然你没有使用完成块,只需使用“old”方法presentModalViewController:animated ::

[self presentModalViewController:matchSetup animated:YES];

猜你在找的Xcode相关文章