尝试打印时,iOS模拟器崩溃

时间:2014-05-20 10:44:23

标签: ios ios-simulator

尝试使用我的7.1 iOS模拟器进行打印时,我总是遇到此错误:

2014-05-20 12:30:15.293 iPrax[1570:60b] *** Terminating app due to uncaught exception  'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'

*** First throw call stack:
(
0   CoreFoundation                      0x036011e4 __exceptionPreprocess + 180
1   libobjc.A.dylib                     0x032cb8e5 objc_exception_throw + 44
2   CoreFoundation                      0x035b3abc -[__NSArrayM insertObject:atIndex:] + 844
3   CoreFoundation                      0x035b3760 -[__NSArrayM addObject:] + 64
4   UIKit                               0x01cb1807 -[UIPrinterBrowserViewController initWithPrintPanelViewController:] + 565
5   UIKit                               0x01cb5206 -[UIPrintPanelTableViewController tableView:didSelectRowAtIndexPath:] + 145
6   UIKit                               0x018709a1 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1513
7   UIKit                               0x01870b14 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 279
8   UIKit                               0x0187510e __38-[UITableView touchesEnded:withEvent:]_block_invoke + 43
9   UIKit                               0x017a40aa ___afterCACommitHandler_block_invoke + 15
10  UIKit                               0x017a4055 _applyBlockToCFArrayCopiedToStack + 403
11  UIKit                               0x017a3e76 _afterCACommitHandler + 532
12  CoreFoundation                      0x035c936e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
13  CoreFoundation                      0x035c92bf __CFRunLoopDoObservers + 399
14  CoreFoundation                      0x035a7254 __CFRunLoopRun + 1076
15  CoreFoundation                      0x035a69d3 CFRunLoopRunSpecific + 467
16  CoreFoundation                      0x035a67eb CFRunLoopRunInMode + 123
17  GraphicsServices                    0x043bc5ee GSEventRunModal + 192
18  GraphicsServices                    0x043bc42b GSEventRun + 104
19  UIKit                               0x01786f9b UIApplicationMain + 1225
20  iPrax                               0x0000da46 main + 134
21  libdyld.dylib                       0x03b89701 start + 1
)
 libc++abi.dylib: terminating with uncaught exception of type NSException

有没有人有同样的问题?单击iOS

的打印对话框中的选择打印机按钮时发生异常

2 个答案:

答案 0 :(得分:0)

您正在尝试将nil对象添加/插入到数组中,这会导致崩溃。所以在添加/插入对象到数组之前,请测试

if (yourObjectToBeAddedOrInserted!=nil) {

    [yourArray addObject:yourObjectToBeAddedOrInserted];

    //Or

    //[yourArray insertObject:yourObjectToBeAddedOrInserted atIndex:someIndex];

}

答案 1 :(得分:0)

在这里有同样的问题。但点击"重置内容和设置后消失了#34;在ios模拟器的子菜单上。 希望它有所帮助!!