我正在尝试使用 Core Data 为 macOS 运行一个基本的测试 SwiftUI 应用程序,但我遇到了一个问题。当我在我看来使用它时:
@FetchRequest(entity: Note.entity(), sortDescriptors: []) let notes: FetchedResults<Note>
该应用程序崩溃并出现以下错误:
NoteTaker [error] error: No NSEntityDescriptions in any model claim the NSManagedObject subclass 'NoteTaker.Note' so +entity is confused. Have you loaded your NSManagedObjectModel yet ?
CoreData: error: No NSEntityDescriptions in any model claim the NSManagedObject subclass 'NoteTaker.Note' so +entity is confused. Have you loaded your NSManagedObjectModel yet ?
NoteTaker [error] error: +[NoteTaker.Note entity] Failed to find a unique match for an NSEntityDescription to a managed …Run Code Online (Sandbox Code Playgroud)