3

我正在使用 Flurry 跟踪我的 iPhone 应用程序的统计信息,最近我看到了几个非常奇怪的错误。看似随机的对象正在接收“numberOfSectionsInTableView”消息,我不知道如何/为什么。该应用程序是使用 4.2.1 SDK 构建的,面向 iOS 4.0 设备。以下是一些示例的片段:


NSInvalidArgumentException: -[NSCFString numberOfSectionsInTableView:]: unrecognized selector sent to instance 0x4f3de10

NSInvalidArgumentException: -[__NSCFData numberOfSectionsInTableView:]: unrecognized selector sent to instance 0x4f55bc0

NSInvalidArgumentException: -[NSPathStore2 numberOfSectionsInTableView:]: unrecognized selector sent to instance 0x4f5ebc0

NSInvalidArgumentException: -[__NSCFType numberOfSectionsInTableView:]: unrecognized selector sent to instance 0x2ac5f0

NSInvalidArgumentException: -[PLPhoto numberOfSectionsInTableView:]: unrecognized selector sent to instance 0x2fbc30

NSInvalidArgumentException: -[PLPhotoLibrary numberOfSectionsInTableView:]: unrecognized selector sent to instance 0x725ea20

我只在我常用的 UITableView 委托方法中指定 numberOfSectionsInTableView,而不是直接调用它。我发现直接调用此方法的唯一代码在 ASIHTTPRequest 库中:


    if (section == [self numberOfSectionsInTableView:aTableView]-1) {
        return 30;
    }
    return 0;

但这是在“ASIAuthenticationDialog.m”中,我没有将身份验证与 ASIHTTPRequest 一起使用。

有没有人见过这样的事情?我对任何和所有建议持开放态度,在这里很困惑,到目前为止无法重现它。

谢谢。

4

2 回答 2

3

听起来像是一个经典的过度释放问题。您已经过度释放了一个对象,而正在向其他一些随机对象发送消息。

打开僵尸检测并再次尝试您的测试用例。

于 2011-02-20T21:36:16.153 回答
0

我有同样的问题,我的问题是我在方法中本地创建了数据源,它运行到相同的内存问题

- (void)setupDataSource {
  /* some code to create sections */
  TransactionDetailDataSource *dataSource = [[TransactionDetailDataSource alloc] initWithSections:sections];

  self.tableView.dataSource = dataSource;
  self.tableView.delegate = dataSource;

  [self.tableView reloadData];
}

...所以我不得不创建新的财产

@property (nonatomic, strong) TransactionDetailDataSource *dataSource;

并添加这一行

self.dataSource = dataSource;

在方法结束时。

于 2016-03-08T11:51:57.507 回答