【发布时间】:2013-05-13 19:16:34
【问题描述】:
此代码是从“设置”选项卡内的“导航”视图中调用的。它在 iOS 5.1 中的最后一行崩溃,但在 iOS 6 中没有。为什么?
else if (indexPath.section == 0 && [[settingsArray objectAtIndex:indexPath.row] isEqualToString:@"Unlock Premium Features"])
{
InAppViewController *inappController = [[InAppViewController alloc] initWithNibName:@"InAppViewController" bundle:nil];
inappController.titleString = @"Upgrade to Pro.";
EditNavController *navController = [[EditNavController alloc] initWithRootViewController:inappController];
[self.navigationController presentModalViewController:navController animated:NO];
}
它崩溃了:
[self.navigationController presentModalViewController:navController animated:NO];
这是崩溃:
*** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named NSLayoutConstraint'
【问题讨论】:
-
任何特定的崩溃消息/堆栈跟踪/任何东西?
-
它在
presentModalViewController线上崩溃了吗? -
你确定不是反过来吗? 'presentModalViewController' 在 iOS 6 中已弃用。它可以替换为 presentViewController:animated:completion。 (stackoverflow.com/questions/12507455/…)
-
@leanne,'deprecated' 并不意味着'broken' - 它意味着'我们将在下一个版本中打破它';-j
-
是的,对不起 - 那是一个“呃”的时刻......
标签: iphone ios objective-c