class B: Object { dynamic let lists = List<A>() }
Property cannot be marked as dynamic because its type cannot be represented in Objective-C
我看到Realm的文档说:
Realm model properties need the dynamic var attribute in order for these properties to become accessors for the underlying database data.
There are two exceptions to this: List and RealmOptional properties
cannot be declared as dynamic because generic properties cannot be
represented in the Objective-C runtime,which is used for dynamic
dispatch of dynamic properties,and should always be declared withlet
但是现在似乎没有解决这个问题.我错过了什么?
List and RealmOptional properties cannot be declared as dynamic because generic properties cannot be represented in the Objective-C runtime,[…],and should always be declared with
let
.
这意味着您的属性应该如下声明:
let lists = List<A>()
Realm Swift文档最近获得了property declaration cheatsheet,希望能够澄清不同类型声明的要求.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。