记录一个日常开发遇到的问题:
定义了一个数据model,继承自NSObject,在Swift中使用model.value(forKey: "key1")时闪退,报错:this class is not key value coding-compliant for the key

解决方法:
KVC是OC的特性,只继承自NSObject是不够的,还要加上@objcMembers关键字

记录一个日常开发遇到的问题:
定义了一个数据model,继承自NSObject,在Swift中使用model.value(forKey: "key1")时闪退,报错:this class is not key value coding-compliant for the key
解决方法:
KVC是OC的特性,只继承自NSObject是不够的,还要加上@objcMembers关键字
本文标题:Swift报错this class is not key val
本文链接:https://www.haomeiwen.com/subject/idxdcctx.html
网友评论