PresentViewController 在 iOS 4.3 上崩溃,但在 iOS 5 上不会崩溃
谁能告诉我为什么这段代码在 4.3 模拟器上因发送到实例的 SIGABRT 无法识别的选择器而崩溃,但在 iOS 5 模拟器上工作得很好?
matchSetup = [[viewMatchSetup alloc]initWithNibName:@"viewMatchSetup" bundle:nil];
[matchSetup setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentViewController:matchSetup animated:YES completion:NULL];
提前致谢
修复:[selfpresentModalViewController:matchSetupanimated:YES]; //模态是需要改变的
Can anyone tell me why this code crashes with SIGABRT unrecognised selector sent to instance, on 4.3 simulator, but works just fine on iOS 5 simulator?
matchSetup = [[viewMatchSetup alloc]initWithNibName:@"viewMatchSetup" bundle:nil];
[matchSetup setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentViewController:matchSetup animated:YES completion:NULL];
Thanks in advance
FIX: [self presentModalViewController:matchSetup animated:YES]; //Modal being the required change
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它崩溃是因为
UIViewController
的presentViewController:animated:completion:
方法在 iOS 4.3 上不可用。它是在 iOS 5 中引入的。由于您不使用完成块,因此只需使用“旧”方法presentModalViewController:animated:
:It crashes because the
presentViewController:animated:completion:
method ofUIViewController
is not available on iOS 4.3. It was introduced in iOS 5. Since you don't use the completion block, simply use the "old" methodpresentModalViewController:animated:
: