当我在 IOS 8 中运行它时,我得到 NSRangeException 异常
UIActionSheet *uias = [[UIActionSheet alloc] initWithTitle:@"Test"
delegate:self
cancelButtonTitle:@"Test"
destructiveButtonTitle:@"Test"
otherButtonTitles:@"Test", nil];
[uias showInView:self.view];
输出异常:
2014-09-26 22:18:17.106 rcherzios[354:51170] * 由于未捕获的异常“NSRangeException”而终止应用程序,原因:“* -[__NSArrayM replaceObjectAtIndex:withObject:]:索引 0 超出空数组的范围” *首先throw call stack: (0x2b153f87 0x38bc6c77 0x2b071331 0x10b587 0x2b96109b 0x2b961211 0x2b965897 0x2b963141 0x2b963579 0x2b964391 0x2b964215 0x2b966e2d 0x2b9641ab 0x2b99e65b 0x2b99d067 0x2b99ca87 0x2b9643e7 0x2b964215 0x2b966e2d 0x2b9641ab 0x2b99bd01 0x2b966e2d 0x2b99bc79 0x2b953bed 0x2b953ceb 0x2b11a82d 0x2b119af1 0x2b11864b 0x2b065db1 0x2b0af6cb 0x2b966b7f 0x392a6e67 0x392a6ddb 0x392a4b84) libc++abi.dylib: terminating with uncaught NSException 类型的异常信号:6(信号 SIGABRT)
在 IOS7 甚至在模拟器 IOS 8 中一切正常,只是在 IOS8 的真实设备上它崩溃了......
看起来在我工作了 3 年的复杂应用程序中,所有 UIAlertView 都因相同的异常而崩溃,我试图测试新的 UIAlertController 并有相同的异常。所以我的结论是我的应用程序的某些配置导致 UIAlertController 出现问题,实际上 UIAlertView 和 UIActionSheet 在 ios 8 中使用的是什么。