Core Data fetch: EXC_BREAKPOINT (code=1, subcode=0x18451a014)

629 Views Asked by At

Whenever I'm running the app in Xcode, I'm running into this issue and I can't really figure out what to do. I'm just trying to fetch all the items in an entity in Core Data, returning a Job array. The only thing I can do if this happens is stop the the app, close it, and open it in the emulator without clicking on the run button.

Here's the image of the code and the error I'm talking about:

enter image description here

Is there anything I can do to fix this? Is this a debug issue or is it a real app problem?

1

There are 1 best solutions below

0
lorem ipsum On

You would use something like this

func generateData(context: NSManagedObjectContext) async throws {
    try await context.perform {
        //Your fetch code here
    }
}

Here is a WWDC video on the subject https://developer.apple.com/wwdc21/10017

The biggest thing I think is not chaining these calls try an condense them, I recently had a client that that was calling perform inside other performs.

async await is all about straight lines you should know exactly what is happening, when it is happening and in what order. There is no hanging on to anything.