iOS:由于Xcode 9中已获取索引,因此无法编译CoreData模型 [英] iOS: Can't compile CoreData model because of Fetched Indexes in Xcode 9

查看:152
本文介绍了iOS:由于Xcode 9中已获取索引,因此无法编译CoreData模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据发行说明,Xcode 9添加了对获取的索引的支持:

According to the release notes, Xcode 9 adds support for fetched indexes:

数据模型编辑器为Core Data的 新的访存索引功能及其现有的属性索引和 实体复合索引特征.较旧的数据模型被转换为 提取索引表以进行编辑,并在保存时以旧文件格式保存 必要的.编译部署目标低于以下目标的数据模型 iOS 11,watchOS 4,macOS 10.13或tvOS 11继续生成 兼容的编译形式. (30843153)"

"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)"

我的项目目前已将Deployment Target设置为iOS 9,但我仍无法编译CoreData模型,对于每个设置了复合索引的实体,它给我以下错误:

My project has Deployment Target set to iOS 9 at the moment a yet I can't compile my CoreData model, it gives me the following errors for every entity that has a compound index set:

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  

您知道如何解决构建错误吗?

Any idea how to fix the build error?

更新:

如已知问题"部分所述,对于从关系创建的所有情况,Xcode 9均可将复合索引正确转换为获取索引:

Xcode 9 correctly converts compound indexes into fetch indexes for all cases except those created from relationships, as noted in the "Known Issues" section:

数据模型编辑器仅支持从此Beta中的属性和表达式创建提取索引,而不能从关系创建提取索引. (32407895)

The data model editor only supports creating fetch indexes from attributes and expressions in this beta, not from relationships. (32407895)

受影响的提取索引如下所示,并且只能从下拉菜单中选择属性:

The affected fetch indexes look like this and the only attributes can be selected from the dropdown menu:

但是,文档中没有描述解决方法.

However, there's no workaround described in the document.

推荐答案

根据

Xcode数据模型编辑器支持从中创建访存索引 属性,表达式和关系. (32407895)

The Xcode data model editor supports creating fetch indexes from attributes, expressions, and relationships. (32407895)

这篇关于iOS:由于Xcode 9中已获取索引,因此无法编译CoreData模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆