Skip to content

NSEntityDescription can only be used in a single MOM #20

Closed
@helje5

Description

@helje5

I guess it is OK, but one entity can only be used in a single MOM, otherwise it throws an internal inconsistency exception:

Can't use an entity in two models.

There is no really nice way around it, but internally MOMs are already uniqued based on the input types, so that is probably not a huge deal in practice.

Also, MOMs do not seem to go away when they are released. Or the entities keep a backref to them:

    try autoreleasepool { // doesn't help
      let schema1 = NSManagedObjectModel(
    }
    // Can't use an entity in two models. (NSInternalInconsistencyException)
    let schema2 = NSManagedObjectModel(
      [ Fixtures.PersonAddressSchema.Person.self ],
      schemaCache: cache
    )

Not sure there is a way around this. Entities could be copied, but they are likely still tied to the classes?

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghelp wantedExtra attention is needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions