用KVC来设定father.name的值的时候报错
来源:8-1 KVO介绍
慕设计0203943
2019-05-18
2019-05-18 13:20:53.415155+0800 KVC介绍[1170:71723] *** Terminating app due to uncaught exception ‘NSUnknownKeyException’, reason: ‘[<Person 0x100711770> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key father.name.’
写回答
1回答
-
最好贴上代码,好分析。
这里有两点注意:
person里有father对象,father里有name属性
需要调用[person setValue:@"zhangsan" forKeyPath:@"father.name"],而不是
[person setValue:@"zhangsan" forKey:@"father.name"];
022019-05-19
相似问题