【问题标题】:No visible interface for nsmutabledictionary declares the selector setobject:forkey: [closed]nsmutabledictionary 没有可见接口声明选择器 setobject:forkey: [关闭]
【发布时间】:2012-08-30 17:32:55
【问题描述】:

谁能指出我为什么会收到编译错误

[objToSend setObject:self.pathidEdit forkey:@"PathId"];
[objToSend setObject:indexData forkey:@"data"];

在下面的代码中?

NSMutableArray *indexData = [[NSMutableArray alloc]init];

        NSMutableDictionary *dict = [NSMutableDictionary dictionary];
        NSMutableDictionary *objToSend = [NSMutableDictionary dictionary];

        for(int i=0;i<myPathvideoArray.count;i++)
        {


        NSString *vId=[[myPathvideoArray objectAtIndex:i]valueForKey:@"videoId"];
    NSNumber *indexNum = [NSNumber numberWithInt:i+1];

            [dict setObject:vId forKey: @"VideoId"];

            [dict setObject:indexNum forKey: @"index"];

            [indexData addObject:dict];



        }

        [objToSend setObject:self.pathidEdit forkey:@"PathId"];
        [objToSend setObject:indexData forkey:@"data"];

【问题讨论】:

  • myPathvideoArray 是字典数组?
  • 不要介意“forKey”的 k 是小写字母... :D 谢谢...大声笑

标签: objective-c ios nsmutabledictionary


【解决方案1】:

Objective-C 区分大小写:

这是正确的:

[dict setObject:object forKey:key];

虽然不是这样:

[dict setObject:object forkey:key];

【讨论】:

  • 大家好,我真的很抱歉发布了这样一个愚蠢的问题,但我的帐户从那时起就被否决了,我不能再问问题了。如果有人可以投票给它。我会确保我不再发布这样的小问题!!非常感谢!再次抱歉这个问题!
猜你喜欢
  • 1970-01-01
  • 2014-01-19
  • 1970-01-01
  • 1970-01-01
  • 2014-04-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多