Is there a way to resolve this error: "CloudKit integration requires does not support ordered relationships."

Is there a way to resolve this error: "CloudKit integration requires does not support ordered relationships."

我正在尝试使用 Apple 的 CoreDataCloudkitDemo 应用程序。我只根据他们的自述文件更改了应用程序设置。在 运行 演示中,出现错误:"CloudKit integration requires does not support ordered relationships."

(标题中的诡异语法已包含在应用中)

控制台日志显示:

Fatal error: ###persistentContainer: Failed to load persistent stores:Error Domain=NSCocoaErrorDomain Code=134060 "A Core Data error occurred." UserInfo={NSLocalizedFailureReason=CloudKit integration requires does not support ordered relationships. The following relationships are marked ordered:  
Post: attachments  

"Tags" 实体也有同样的错误。

我正在使用 Xcode 11.0 beta 4 (11M374r)。

我只更改了包标识符,并设置了我的团队 ID。

我删除了原始授权文件 - 生成的构建没有错误。

我没有更改原始代码。

有没有人有解决方法,或者最好是修复方法?还是我做错了什么?

谢谢

首先,select CoreDataCloudKitDemo.xcdatamodeld -> Post -> RelationShips, select attachments 关系,在 Inspect 面板上,deselect Ordered,然后在 tags 关系上做同样的事情。

其次,现在的代码会有一些错误,因为我们没有勾选Ordered选项,attachments的属性和[=11] =] 在生成的 NSManagedObject 中可能会从 NSOrderedSet? 更改为 NSSet?。所以我们可以像下面这样更改这些错误代码行:

来源: guard let tag = post?.tags?.object(at: indexPath.row) as? Tag else { return cell }

已更改: guard let tag = post?.tags?.allObjects[indexPath.row] as? Tag else { return cell }

最后,您现在可以 运行 代码了。 ;-)


此外,在 WWDC19 Session 202 上,演示显示他们将附件和标签关系都设置为 Unordered,所以我认为给定的演示项目有问题。