【发布时间】:2014-10-28 23:53:34
【问题描述】:
当我尝试在列表中删除或添加对象时遇到问题
错误:
2014-09-04 10:59:03.815 DeleteListTest[2781:60b] *** 断言失败 -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-2935.137/UITableView.m:1368
2014-09-04 10:59:03.856 DeleteListTest[2781:60b] *** 由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:“无效更新:第 0 节中的行数无效。包含在更新后的现有节 (9) 必须等于更新前该节中包含的行数 (10),加上或减去从该节插入或删除的行数(0 插入,0 删除),加上或减去移入或移出该部分的行数(0移入,0移出)。
*** 首先抛出调用堆栈:
(
0 核心基础 0x01b581e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x018d78e5 objc_exception_throw + 44
2 CoreFoundation 0x01b58048 + [NSException raise:format:arguments:] + 136
3 基础 0x014b74de-[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116
4 UIKit 0x0066ff63-[UITableView _endCellAnimationsWithContext:] + 13402
5 UIKit 0x0067fcea-[UITableView endUpdatesWithContext:] + 51
6 UIKit 0x0067fd18-[UITableView endUpdates] + 41
7 DeleteListTest 0x00002ece -[MasterViewController leaveEditMode] + 270
8 DeleteListTest 0x0000301a-[MasterViewController tableView:commitEditingStyle:forRowAtIndexPath:] + 202
9 UIKit 0x006916a3-[UITableView animateDeletionOfRowWithCell:] + 107
10 UIKit 0x0081a595-[UITableViewCell_swipeDeleteButtonPushed] + 70
11 libobjc.A.dylib 0x018e9880-[NSObject performSelector:withObject:withObject:] + 77
12 UIKit 0x005993b9-[UIApplication sendAction:to:from:forEvent:] + 108
13 UIKit 0x00599345-[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
14 UIKit 0x0069abd1-[UIControl sendAction:to:forEvent:] + 66
15 UIKit 0x0069afc6-[UIControl_sendActionsForEvents:withEvent:] + 577
16 UIKit 0x0069a243-[UIControl touchesEnded:withEvent:] + 641
17 UIKit 0x0092f2e3 _UIGestureRecognizerUpdate + 7166
18 UIKit 0x005d8a5a-[UIWindow_sendGesturesForEvent:] + 1291
19 UIKit 0x005d9971-[UIWindow 发送事件:] + 1021
20 UIKit 0x005ab5f2 -[UIApplication 发送事件:] + 242
21 UIKit 0x00595353 _UIApplicationHandleEventQueue + 11455
22 核心基础 0x01ae177f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
23 核心基础 0x01ae110b __CFRunLoopDoSources0 + 235
24 核心基础 0x01afe1ae __CFRunLoopRun + 910
25 核心基础 0x01afd9d3 CFRunLoopRunSpecific + 467
26 核心基础 0x01afd7eb CFRunLoopRunInMode + 123
27 图形服务 0x03a0a5ee GSEventRunModal + 192
28 图形服务 0x03a0a42b GSEventRun + 104
29 UIKit 0x00597f9b UIApplicationMain + 1225
30 删除列表测试 0x00004a4d 主要 + 141
31 libdyld.dylib 0x0219f701 开始 + 1
32 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib:以 NSException 类型的未捕获异常终止
(lldb)
这是删除方法
if(editingStyle == UITableViewCellEditingStyleDelete){
[tableTitles removeObjectAtIndex:[indexPath row]];
[self leaveEditMode];
[[self tableView] reloadData];
有人可以帮助我吗?谢谢你:)
【问题讨论】:
-
你是如何实现表格视图数据源协议的。
标签: ios objective-c iphone editing nsexception