【发布时间】:2017-06-23 09:20:33
【问题描述】:
我正在尝试为objectiv-c 中的KVC 做一个示例,我正在使用objective-c 的在线编译器。
我写了下面贴的代码,当我编译它时,我收到以下错误:
jdoodle.m:7:5: warning: 'NSString' may not respond to '-alloc'
[[str alloc] init];
请告诉我如何解决它
代码:
NSString *str;
[[str alloc] init];
[[str setValue:@"value-str"] forKey:@"key-str"];
【问题讨论】:
-
你想用 KVC 完成什么?
标签: objective-c nsstring kvc