[__ NSDictionaryM safeObjectAtIndex:]:无法识别的选择器发送到实例0x60800005e060
[__ NSDictionaryM safeObjectAtIndex:]:无法识别的选择器发送到实例0x60800005e060 [IssuesViewController-tableView:cellForRowAtIndexPath:]
断言失败 - [STCollapseTableView _configureCellForDisplay:forIndexPath:],/ BuildRoot / Library / Cache / com.apple.xbs / Sources / UIKit_Sim / UIKit-3600.7.47 / UITableView.m:8174
由于未捕获的异常终止应用程序' NSInternalInconsistencyException',原因:' UITableView(; layer =; contentOffset:{0,0}; contentSize:{414,115}>)未能从dataSource获取一个单元格(; layer =; contentOffset:{0,0}; contentSize:{414,115}>)' ***首先抛出调用堆栈:
( 0 CoreFoundation 0x0000000108d8bb0b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x00000001087c3141 objc_exception_throw + 48
2 CoreFoundation 0x0000000108d8fcf2 +[NSException raise:format:arguments:] + 98
3 Foundation 0x000000010835d3b6 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193
4 UIKit 0x0000000109aeefcf -[UITableView _configureCellForDisplay:forIndexPath:] + 230
5 UIKit 0x0000000109afa7b8 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 836
6 UIKit 0x0000000109afa9a8 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 74
7 UIKit 0x0000000109acf2e9 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2845
8 UIKit 0x0000000109b0397c -[UITableView _performWithCachedTraitCollection:] + 111
9 UIKit 0x0000000109aeab2a -[UITableView layoutSubviews] + 233
10 UIKit 0x0000000109a5120b -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1268
11 QuartzCore 0x0000000107905904 -[CALayer layoutSublayers] + 146
12 QuartzCore 0x00000001078f9526 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 370
13 QuartzCore 0x00000001078f93a0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
14 QuartzCore 0x0000000107888e92 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
15 QuartzCore 0x00000001078b5130 _ZN2CA11Transaction6commitEv + 468
16 UIKit 0x0000000109987307 _UIApplicationFlushRunLoopCATransactionIfTooLate + 167
17 UIKit 0x000000010a187cab __handleEventQueue + 5843
18 CoreFoundation 0x0000000108d31c01 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
19 CoreFoundation 0x0000000108d170cf __CFRunLoopDoSources0 + 527
20 CoreFoundation 0x0000000108d165ff __CFRunLoopRun + 911
21 CoreFoundation 0x0000000108d16016 CFRunLoopRunSpecific + 406
22 GraphicsServices 0x000000010b8eaa24 GSEventRunModal + 62
23 UIKit 0x000000010998e0d4 UIApplicationMain + 159
24 comress 0x000000010626910f main + 111
25 libdyld.dylib 0x000000010b4d765d start + 1)
libc ++ abi.dylib:以NSException类型的未捕获异常终止 (lldb)
这是示例代码:
NSArray *postDupe = [[_postsArray valueForKeyPath:@"@unionOfArrays.@allValues"] valueForKeyPath:@"post"];
NSArray *foundArray = nil;
predicate = [NSPredicate predicateWithFormat:@"post_id.stringValue contains [c] %@",@"18586"];
foundArray = [postDupe filteredArrayUsingPredicate:predicate];
long foundIndex = 0;
long count = 0;
for (int i=0; i<foundArray.count; i++)
{
foundIndex = [postDupe indexOfObject: [foundArray objectAtIndex: i]];
//NSLog(@"%@ is at index %d", string, index);
}
_filterPostsArray = [_postsArray objectAtIndex:foundIndex];
}
searchActive = YES;
dispatch_async(dispatch_get_main_queue(),^{
[_issuesTable reloadData];
});
示例Json数据:
<__NSArrayM 0x608000449a80>(
{
14556 = {
newCommentsCount = 0;
post = {
"post_id" = 18609;
seen = 1;
status = 0;
statusWasUpdated = 0;
"updated_on" = "1506061049.023";
};
};
},
)
答案 0 :(得分:0)
[__ NSDictionaryM safeObjectAtIndex:]:无法识别的选择器发送到实例
看起来你有一本字典并且把它当成一个数组。
在调试器中运行代码并在算法中检查变量的值,这应该会显示出错的地方。
<强>猜测:强>
post_id.stringValue
中的关键路径应为post.post_id.stringValue
- 您的词典包含一个键post
,其值本身就是一个具有键post_id
的词典。_filterPostsArray = [_postsArray objectAtIndex:foundIndex]
听起来像是在为数组分配字典。您可能希望此语句在循环中并将字典添加到数组中作为新元素吗?HTH