Seam3 icon indicating copy to clipboard operation
Seam3 copied to clipboard

Crash in 2nd app launch

Open lludo opened this issue 7 years ago • 2 comments

First launch everything looks good, always crash in 2nd launch.

screen shot 2018-02-28 at 11 47 58 pm

lludo avatar Mar 01 '18 07:03 lludo

Can you provide more information on how I can reproduce the issue? A minimum example project would help.

I try and avoid force unwraps; those are there from a PR that I accepted. If I remove the force unwraps then it isn't clear how the situation can be handled anyway; If a managed object result type has been requested and managed object ids can't be found, what can be done?

paulw11 avatar Mar 01 '18 21:03 paulw11

I just ran into this issue. I created a reproduction project here

For me, the issue seems to come up when you create a child context of the container that seam is a part of, and then save both the child and the seam container.

Here is the relevant code:

        let context = (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext

        let newContext = NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType)
        newContext.parent = context

        let newItem = Item(context: newContext)
        newItem.name = "something"
        newItem.status = 0
        try? newContext.save()
        try? newContext.parent?.save()

literalpie avatar Feb 08 '20 14:02 literalpie