小编Dea*_*ano的帖子

为 SwiftUI macOS 应用程序使用 @fetchRequest(entity:) 崩溃

我正在尝试使用 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)

macos core-data swift swiftui

8
推荐指数
1
解决办法
1626
查看次数

标签 统计

core-data ×1

macos ×1

swift ×1

swiftui ×1