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

Dan*_*ann 3 crash xcode sigabrt ios

任何人都可以告诉我为什么这个代码崩溃与SIGABRT无法识别的选择器发送到实例,在4.3模拟器上,但在iOS 5模拟器上工作得很好?

matchSetup = [[viewMatchSetup alloc]initWithNibName:@"viewMatchSetup" bundle:nil];
[matchSetup setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentViewController:matchSetup animated:YES completion:NULL];
Run Code Online (Sandbox Code Playgroud)

提前致谢

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

Dar*_*ust 12

它崩溃是因为iOS 4.3上没有这种presentViewController:animated:completion:方法UIViewController.它是在iOS 5中引入的.由于您不使用完成块,只需使用"旧"方法presentModalViewController:animated::

[self presentModalViewController:matchSetup animated:YES];
Run Code Online (Sandbox Code Playgroud)