设置iPod Touch 2G(3.1.3)上的演示样式与SIGABRT崩溃,但在iPod Touch 4G(4.2)上正常工作。这是一个错误吗?有人可以给我一个解决方法吗?
DateDialogController* dlg = [[DateDialogController alloc] initWithNibName:@"DateDialogView" bundle:nil];
[dlg setDelegate:self];
dlg.startDate = self.anchorDate;
self.navigationController.modalPresentationStyle = UIModalPresentationCurrentContext;
[self.navigationController presentModalViewController:dlg animated:YES];
[dlg release];
2011-08-02 13:44:20.785 Mobile Manager[274:207] *** -[UINavigationController setModalPresentationStyle:]: unrecognized selector sent to instance 0x230000
2011-08-02 13:44:20.789 Mobile Manager[274:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UINavigationController setModalPresentationStyle:]: unrecognized selector sent to instance 0x230000'
2011-08-02 13:44:20.799 Mobile Manager[274:207] Stack: (
864992541,
859229716,
864996349,
864492313,
864454720,
346779,
864749711,
839231364,
839231212,
839231156,
839230220,
839233420,
839227648,
839225236,
839206800,
839205012,
875886564,
864740651,
864738335,
875880904,
838872112,
838865456,
54257,
54172
)
terminate called after throwing an instance of 'NSException'
Program received signal: “SIGABRT”.
答案 0 :(得分:0)
您设置的属性modalPresentationStyle
仅适用于iOS3.2 +由于您的iPod正在运行3.1.2,因此它无法响应设置属性的方法
至于解决它,像这样的代码通常有帮助。
DateDialogController* dlg = [[DateDialogController alloc] initWithNibName:@"DateDialogView" bundle:nil];
[dlg setDelegate:self];
dlg.startDate = self.anchorDate;
// Set the property if the iOS version allows it
NSString *currSysVer = [[UIDevice currentDevice] systemVersion];
if ([currSysVer compare:@"3.2" options:NSNumericSearch] != NSOrderedAscending) {
self.navigationController.modalPresentationStyle = UIModalPresentationCurrentContext;
}
[self.navigationController presentModalViewController:dlg animated:YES];
[dlg release];
NSString *currSysVer = [[UIDevice currentDevice] systemVersion];
if ([currSysVer compare:@"3.2" options:NSNumericSearch] != NSOrderedAscending) {