是的,可以set,只是在get的时候crash

解决方案 »

  1.   


    奇怪了,你怎么可以设置上去呢??    NSDictionary *dict=[[NSDictionary alloc] init];
        [dict setValue:@"dd" forKey:@"asf@dasf"];
    我这么写根本运行不通过啊
    reason: '[<__NSDictionaryI 0x7fbe81e0b8f0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key asf@dasf.'
      

  2.   


    奇怪了,你怎么可以设置上去呢??    NSDictionary *dict=[[NSDictionary alloc] init];
        [dict setValue:@"dd" forKey:@"asf@dasf"];
    我这么写根本运行不通过啊
    reason: '[<__NSDictionaryI 0x7fbe81e0b8f0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key asf@dasf.'的确是非常奇怪,不过我的工程使用的是C++和Objective-C混合的mm文件,不知道会不会和这个有关,如果是,不知道算不算XCode的bug.
      

  3.   


    奇怪了,你怎么可以设置上去呢??    NSDictionary *dict=[[NSDictionary alloc] init];
        [dict setValue:@"dd" forKey:@"asf@dasf"];
    我这么写根本运行不通过啊
    reason: '[<__NSDictionaryI 0x7fbe81e0b8f0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key asf@dasf.'的确是非常奇怪,不过我的工程使用的是C++和Objective-C混合的mm文件,不知道会不会和这个有关,如果是,不知道算不算XCode的bug.对了,有个情况忘记说了,我的Key并不是直接写的字符串,是通过StringWith...从C++的array中得到的,不会看到明文@字符的。
      

  4.   

    能设置应该是调用了KVC了,NSDictionary类是由[setObject   forKey  ]吧,setValue是kvc的关键字,不过字典默认也能用kvc吧