问题描述
- 代码在IOS5.1中崩溃,IOS6.1没事
-
下面的代码是从导航视图中调用出来的,在IOS5中运行时,最后一行报错引起崩溃,但是在6.1中运行正常,为什么?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'
解决方案
如果你在视图中用到自动布局(创建新),就会崩溃,因为只有在ios6中才有。
时间: 2024-09-26 02:55:41