gpt4 book ai didi

core-data - iOS : Can't compile CoreData model because of Fetched Indexes in Xcode 9

转载 作者:行者123 更新时间:2023-12-04 12:45:47 25 4
gpt4 key购买 nike

根据发行说明,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)



受影响的提取索引如下所示,可以从下拉菜单中选择唯一的属性:

enter image description here

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

最佳答案

我刚刚在 Xcode 9 GM 中遇到了这个问题。我观察到的是取消选中 Ascending索引编辑器中的复选框导致发生此错误(仅在我创建新索引后才显示)。我假设调整此索引属性仅在 iOS 11 获取索引中受支持(您会注意到在 Xcode 9 之前创建的任何索引默认都列为升序)。

TL;博士 : 确保 Ascending在提取索引编辑器中选中所有属性的复选框。

关于core-data - iOS : Can't compile CoreData model because of Fetched Indexes in Xcode 9,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44386614/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com