[英]tableView:numberOfRowsInSection:]: unrecognized selector sent to instance
[英]numberOfRowsInSection being sent to UIProxyObject when reloading tableView
我有一個 UITableViewController 子類,當它需要從其所有單元格中清除附件視圖時,它會從主隊列中調用[self.tableView reloadData]
。 問題是,當我重新加載 tableView 時,我收到此崩潰日志,表明 numberOfRowsInSection: 被發送到錯誤的 object。 我得到的消息是: -[UIProxyObject tableView:numberOfRowsInSection:]: unrecognized selector sent to instance
這是崩潰日志:
Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x23682a98c __exceptionPreprocess
1 libobjc.A.dylib 0x235a039f8 objc_exception_throw
2 CoreFoundation 0x2367471c8 -[NSOrderedSet initWithSet:copyItems:]
3 CoreFoundation 0x2368301d4 ___forwarding___
4 CoreFoundation 0x236831e6c _CF_forwarding_prep_0
5 UIKitCore 0x2633600ec -[UITableView _numberOfRowsInSection:]
6 UIKitCore 0x2633702d4 -[UISectionRowData refreshWithSection:tableView:tableViewRowData:]
7 UIKitCore 0x2633742e8 -[UITableViewRowData numberOfRows]
8 UIKitCore 0x263331ee8 -[UITableView noteNumberOfRowsChanged]
9 UIKitCore 0x2633315dc -[UITableView reloadData]
10 Lob 0x1028afcfc __49-[LBSiteListTableViewController clearLoadingCells]_block_invoke + 160 (LBSiteListTableViewController.m:160)
11 libdispatch.dylib 0x236268a38 _dispatch_call_block_and_release
12 libdispatch.dylib 0x2362697d4 _dispatch_client_callout
13 libdispatch.dylib 0x236217008 _dispatch_main_queue_callback_4CF$VARIANT$mp
14 CoreFoundation 0x2367bc32c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
15 CoreFoundation 0x2367b7264 __CFRunLoopRun
16 CoreFoundation 0x2367b67c0 CFRunLoopRunSpecific
17 GraphicsServices 0x2389b779c GSEventRunModal
18 UIKitCore 0x263135c38 UIApplicationMain
19 Lob 0x102856f30 main + 14 (main.m:14)
20 libdyld.dylib 0x23627a8e0 start
這是我在表格視圖 controller 中運行的代碼:
- (void) clearLoadingCells {
dispatch_async(dispatch_get_main_queue(), ^{
[[LBAppDelegate tabBarController] clearLoading];
[self.tableView reloadData];
});
}
在我的委托中,我維護了一個正在加載的 URL 列表(只是字符串和一個布爾值):
- (void) clearLoading {
[busyList removeAllObjects];
}
不幸的是,我無法為自己重現此崩潰,我只能在我的 Firebase 控制台中看到 Crashlytics 的日志。
而不是使用 [self.tableView reloadData] 為什么不使用 [self reloadData()]; 因為您的 class 是 UITableViewController 子類。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.