Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in 2nd app launch #80

Open
lludo opened this issue Mar 1, 2018 · 2 comments
Open

Crash in 2nd app launch #80

lludo opened this issue Mar 1, 2018 · 2 comments

Comments

@lludo
Copy link

lludo commented Mar 1, 2018

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

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

@paulw11
Copy link
Owner

paulw11 commented Mar 1, 2018

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?

@literalpie
Copy link
Contributor

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()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants