NSArrayM长度:发送到实例的无法识别的选择器 [英] NSArrayM length : unrecognized selector sent to instance

查看:29
本文介绍了NSArrayM长度:发送到实例的无法识别的选择器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我被烤之前,我要说的是,我已经看过几乎所有关于无法识别的选择器发送到实例"的答案,并尝试了一些建议,但似乎没有任何效果.所以这是我的问题.

Before I get roasted let me say that I have looked at almost all the answers to "unrecognized selector sent to instance" and tried some of the suggestions but nothing seems to work. So here is my question.

我在 viewDidLoad 函数中调用函数 CreateAboutData .

-(void)createAboutData
{
    NSMutableArray *aboutText;

    aboutSections = [[NSMutableArray alloc] initWithObjects:@"About", nil];
    aboutText = [[NSMutableArray alloc] init];
    //Set About Info
    [aboutText addObject:[[NSMutableDictionary alloc] initWithObjectsAndKeys:@"Scoring",@"title",@"Scoring blurb", @"text", nil]];

    aboutData = [[NSMutableArray alloc] initWithObjects:aboutText, nil];
    [aboutText release];
}

控制器,即 aboutView 由我的 HomeView 控制器调用.

The controller i.e. aboutView is called by by my HomeView Controller.

AboutViewTableController *aboutNavController = [[AboutViewTableController alloc] initWithNibName:@"AboutViewTableController" bundle:nil];
    aboutNavController.title = @"About One";

    // Create the nav controller and add the view controllers.
    UINavigationController *theNavController = [[UINavigationController alloc] initWithRootViewController:aboutNavController];

    // Display the nav controller modally.
    [self presentModalViewController: theNavController animated:YES]; <==== THIS IS WHERE IT FAILS

当代码失败时,它会抱怨:--[__ NSArrayM length]:无法识别的选择器发送到实例.

When the code fails it complains that:- -[__NSArrayM length]: unrecognized selector sent to instance .

aboutData与createData函数一起在标头中声明,如下所示:

aboutData is declared in the header along with the createData function as follows:

@interface AboutViewTableController : UITableViewController {
    NSMutableArray *aboutData;
    NSMutableArray *aboutSections;
}

-(void)createAboutData;
@end

所以问题是为什么它会引发异常,我一直在努力,尝试不同的途径都无济于事.我也尝试过将aboutData设置为具有keep和nonatomic设置的属性,但是会出现相同的问题.也很困惑,因为没有地方查询长度.谢谢

So the question is why is it raising an exception I have been racking and trying different avenues to no avail. I have also tried making aboutData a property with retain and nonatomic set but the same problem arises. Am puzzled too because no where to query for the length. Thanks

推荐答案

嘿,我以前有这个.您正在执行此操作的某个地方:[array length];但是数组使用"count",而不是"length".

Heh, I had this before. Somewhere you're doing this: [array length]; but arrays use "count", not "length".

通常在OT中有时会混淆其命名约定

Gets confusing with their naming conventions sometimes, usually in OT

这篇关于NSArrayM长度:发送到实例的无法识别的选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆