繁体   English   中英

重新加载 tableView 时将 numberOfRowsInSection 发送到 UIProxyObject

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM