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

时间:2012-02-07 12:32:09

标签: ios xcode crash sigabrt

有人能告诉我为什么这个代码在4.3模拟器上发送到实例的SIGABRT无法识别的选择器崩溃,但在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]; //模态是必需的更改

1 个答案:

答案 0 :(得分:12)

崩溃是因为iOS 4.3上没有presentViewController:animated:completion:的{​​{1}}方法。它是在iOS 5中引入的。由于您不使用完成块,只需使用“旧”方法UIViewController

presentModalViewController:animated: