简体   繁体   English

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

[英]numberOfRowsInSection being sent to UIProxyObject when reloading tableView

I have a UITableViewController subclass that calls [self.tableView reloadData] from the main queue whenever it needs to clear accessory views from all of its cells.我有一个 UITableViewController 子类,当它需要从其所有单元格中清除附件视图时,它会从主队列中调用[self.tableView reloadData] The problem is, I get this crash log indicating that numberOfRowsInSection: was sent to the wrong object when I reload the tableView.问题是,当我重新加载 tableView 时,我收到此崩溃日志,表明 numberOfRowsInSection: 被发送到错误的 object。 The message I get is: -[UIProxyObject tableView:numberOfRowsInSection:]: unrecognized selector sent to instance我得到的消息是: -[UIProxyObject tableView:numberOfRowsInSection:]: unrecognized selector sent to instance

and here is the crash log:这是崩溃日志:

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

This is the code I run in my table view controller:这是我在表格视图 controller 中运行的代码:

- (void) clearLoadingCells {
    dispatch_async(dispatch_get_main_queue(), ^{
        [[LBAppDelegate tabBarController] clearLoading];
        [self.tableView reloadData];
    });
}

and in my delegate, I maintain a list of URLs that are loading (just strings and a boolean):在我的委托中,我维护了一个正在加载的 URL 列表(只是字符串和一个布尔值):

- (void) clearLoading {
    [busyList removeAllObjects];
}

Unfortunately, I cannot reproduce this crash for myself, I am only seeing the logs in my Firebase console for Crashlytics.不幸的是,我无法为自己重现此崩溃,我只能在我的 Firebase 控制台中看到 Crashlytics 的日志。

instead of using [self.tableView reloadData] why dont you use [self reloadData()];而不是使用 [self.tableView reloadData] 为什么不使用 [self reloadData()]; as your class is UITableViewController subclass.因为您的 class 是 UITableViewController 子类。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 tableView:numberOfRowsInSection:]: 无法识别的选择器发送到实例 - tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 什么时候是tableView:numberOfRowsInSection:在UITableView中调用? - When is tableView:numberOfRowsInSection: called in UITableView? [UIViewController tableView:numberOfRowsInSection:]: 无法识别的选择器发送到实例 - [UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance -[UIViewController tableView:numberOfRowsInSection:]: 无法识别的选择器发送到实例 - -[UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance UIViewController被关闭时重新加载TableView? - Reloading TableView when a UIViewController is being dismissed? 搜索时发生tableView:numberOfRowsInSection错误 - tableView:numberOfRowsInSection error when searching tableview无法正常工作 - [UIViewController tableView:numberOfRowsInSection:]:无法识别的选择器发送到实例 - tableview not working - [UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 在tableView(_:numberOfRowsInSection :)中引发错误时该怎么办? - What to do when error thrown in tableView(_:numberOfRowsInSection:)? 使用UITableView时,ios-tableView:numberOfRowsInSection…NSInvalidArgumentException - ios - tableView:numberOfRowsInSection …NSInvalidArgumentException when working with UITableView 'NSInvalidArgumentException'-[UIViewController tableView:numberOfRowsInSection:]-无法识别的选择器已发送到实例 - 'NSInvalidArgumentException' - [UIViewController tableView:numberOfRowsInSection:] - unrecognized selector sent to instance
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM