0

I have the problem that my fetch request doesn't seem to work on WatchOS.

I enabled the "Watch APPNAME Extension" on my Database model but I still get that error (runtime) in my WatchOS ContentView.swift: Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)

My code:

struct ContentView: View {

    @Environment(\.managedObjectContext) var moc
    @FetchRequest(entity: Code.entity(), sortDescriptors: []) var codes: FetchedResults<Code>

    var body: some View {
        Text("#\(self.codes.count)") <-- Error occurs here :(
    }
}

I'm pretty new to swift so I followed a tutorial by hackingwithswift.com.

JanB
  • 23
  • 6

0 Answers0