无法识别的选择器发送到Array中的实例

Vis*_*hnu -5 iphone objective-c nsmutablearray ipad ios

我试图将一个对象添加到一个数组,但它发送zig bart错误"无法识别的选择器发送到实例"下面是我的代码

AppDelegate     *appdelegate              = (AppDelegate *)[[UIApplication sharedApplication]delegate];
    NSDictionary *infomation = [self dictionaryWithContentsOfJSONString:@"Contacts.json"];
    IstructContactsOrgByEntity *ObjIstructContactsOrgByEntity=[[IstructContactsOrgByEntity alloc]initWithIstructContactsOrgByEntity:infomation];
    NSArray *array=[infomation objectForKey:@"contacts_list"];
    for (int ndx = 0; ndx < [array count]; ndx++)
    {
        NSDictionary *stream = (NSDictionary *)[array objectAtIndex:ndx];
        IstructContacts_List *ObjIstructContacts_List=[[IstructContacts_List alloc]initWithIstructContacts_List:stream];
        NSArray *Qnarray=[stream objectForKey:@"contacts"];
        for (int i=0; i<Qnarray.count; i++)
        {
            NSDictionary *Qnstream = (NSDictionary *)[Qnarray objectAtIndex:i];
            IstructContacts *ObjIstructContacts=[[IstructContacts alloc]initWithIstructContacts:Qnstream];
            [ObjIstructContacts_List.m_muteArrContacts addObject:ObjIstructContacts];
        }

        [ObjIstructContactsOrgByEntity.m_muteArrContacts_List addObject:ObjIstructContacts_List];

    }
    [appdelegate.m_ArrContactsOrgEntity addObject:ObjIstructContactsOrgByEntity];
Run Code Online (Sandbox Code Playgroud)

最后一行 [appdelegate.m_ArrContactsOrgEntity addObject:ObjIstructContactsOrgByEntity]; 是我遇到的问题.

Mic*_*ann 5

你的问题是编译器认为你已声明"m_ArrContactsOrgEntity "为NSMutableArray以外的其他内容.

否则,您将看不到"无法识别的选择器"错误.

另外一些建议,Objective-C中的最佳实践是变量应始终以小写字母开头.将" ObjIstructContacts"," Qnarray"和" Qnstream"改为以小写字母开头.