简体   繁体   English

[NSCFArray行]:无法识别的选择器已发送到实例0x3953a20

[英][NSCFArray row]: unrecognized selector sent to instance 0x3953a20

I get a crash with this console message: 我收到此控制台消息崩溃:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFArray row]: unrecognized selector sent to instance 0x3953a20' 由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'***-[NSCFArray行]:无法识别的选择器已发送到实例0x3953a20'

This happens when I scroll trough a table that gets its data from an array of dictionaries. 当我滚动通过从字典数组中获取其数据的表时,会发生这种情况。

Look in the crash log's stack trace to see where exactly this call is happening. 查看崩溃日志的堆栈跟踪,以查看此调用的确切位置。

If the variable you're sending -row to isn't actually typed as an NSArray, it's likely that you've failed to follow the memory management rules for that variable. 如果您要发送-row的变量实际上没有键入为NSArray,则可能是您未遵循该变量的内存管理规则。 These same symptoms are very commonly caused by that. 这些相同的症状通常是由其引起的。 Something that responds to -row could have existed at one point, been deallocated because you didn't -retain it, and then an NSArray was later allocated in that spot. 响应-row的某些内容可能曾经存在于某个位置,因为您没有-retain保留它而被释放了,然后在该位置分配了NSArray。

Run a "Build & Analyze," and re-re-review the memory management guidelines until you know them in your sleep. 运行“构建和分析”,然后重新检查内存管理准则,直到您在睡眠中知道它们为止。

Looks like you are sending a row message to an NSArray . 看起来您正在向NSArray发送row消息。 There is no row method defined in the NSArray class. NSArray类中没有定义行方法。 If you are using a table, my guess is you want to send "row" to the indexPath parameter to get the position and then get the data at that position in your data array: 如果使用的是表,我想是要向indexPath参数发送“行”以获取位置,然后获取数据数组中该位置的数据:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    // first row will be like 0
    NSUInteger row = [indexPath row];
    // get the same row position in your data array
    id data = [YOUR_DATA_ARRAY objectAtIndex:row];
}

That will give you the numeric position of the row. 这将为您提供该行的数字位置。 One caveat: "row" is not part of the base NSIndexPath class. 一个警告:“行”不是基本NSIndexPath类的一部分。 It's added as a category in UIKit . 它已添加为UIKit中的类别

暂无
暂无

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

相关问题 [__NSCFArray 长度]:无法识别的选择器发送到实例 - [__NSCFArray length]: unrecognized selector sent to instance [NSCFArray length]:发送到实例的无法识别的选择器 - [NSCFArray length]: unrecognized selector sent to instance - [__ NSCFArray objectForKey:]:无法识别的选择器发送到实例0x11c824e0 - -[__NSCFArray objectForKey:]: unrecognized selector sent to instance 0x11c824e0 解析json并获取异常,原因:'-[__ NSCFArray objectForKey:]:无法识别的选择器已发送到实例0x7b1c7630 - parsing json and getting exception, reason: '-[__NSCFArray objectForKey:]: unrecognized selector sent to instance 0x7b1c7630 由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'-[__ NSCFArray length]:无法识别的选择器已发送到实例 - Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFArray length]: unrecognized selector sent to instance 解析json并获取NSInvalidArgumentException',原因:'-[__ NSCFArray objectForKey:]:无法识别的选择器已发送到实例 - parsing json and getting NSInvalidArgumentException', reason: '-[__NSCFArray objectForKey:]: unrecognized selector sent to instance ContiguousArrayStorage行无法识别的选择器发送到实例 - ContiguousArrayStorage row unrecognized selector sent to instance -[__ NSCFNumber行]:无法识别的选择器已发送到实例 - -[__NSCFNumber row]: unrecognized selector sent to instance 无法识别的选择器已发送到实例 - Unrecognized selector sent to instance “无法识别的选择器已发送到实例” - 'Unrecognized selector sent to instance'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM