根据发行说明,Xcode 9增加了对获取索引的支持:
“The data model editor presents a unified interface for Core Data’s
new fetch indexes feature as well as its existing property index and
entity compound index features. Older data models are translated into
fetch index form for editing,and saved to the old file format when
necessary. Compiling a data model with a Deployment Target lower than
iOS 11,watchOS 4,macOS 10.13,or tvOS 11 continues to generate a
compatible compiled form. (30843153)”
我的项目目前已将部署目标设置为iOS 9,但我无法编译我的CoreData模型,它为每个具有复合索引集的实体提供了以下错误:
Model.xcdatamodeld/Model.xcdatamodel:MyEntity|compoundindex[0]: error: Expression requires a concrete result type. Model.xcdatamodeld/Model.xcdatamodel:MyEntity|compoundindex[0]: error: Expression attributes are not compatible with the current deployment target. Model.xcdatamodeld/Model.xcdatamodel:MyEntity|compoundindex[1]: error: Expression requires a concrete result type. Model.xcdatamodeld/Model.xcdatamodel:MyEntity|compoundindex[1]: error: Expression attributes are not compatible with the current deployment target. Model.xcdatamodeld/Model.xcdatamodel:MyEntity: error: Fetch Indexes feature requires iOS deployment target 11.0 or later Model.xcdatamodeld/Model.xcdatamodel:MyEntity: error: Fetch Indexes feature requires Xcode 9.0 tools or later
知道如何修复构建错误吗?
更新:
除了从关系创建的情况外,Xcode 9正确地将复合索引转换为获取索引,如“已知问题”部分所述:
The data model editor only supports creating fetch indexes from attributes and expressions in this beta,not from relationships. (32407895)
但是,文档中没有描述的解决方法.