adi*_*dit 0 iphone objective-c ipad ios
我有以下代码,但是当我尝试使用此键从该字典中获取值时,它会崩溃.当我删除@时,它工作得很好.任何的想法?
[self.replacementFBMsgDictionary_ setValue:profileItem.fbId forKey:[NSString stringWithFormat:@"@%@", profileItem.username]];
Run Code Online (Sandbox Code Playgroud)
问题是,密钥开头的"@"在键值编码中具有特殊意义 - 它用于集合运算符@count.因此,KVC键不能以该字符串开头.因此setValue:forKey:,您必须使用NSDictionary的原语而不是KVC setObject:forKey:.
| 归档时间: |
|
| 查看次数: |
60 次 |
| 最近记录: |