Reputation: 4308
I want to create an instance of an NSManagedObject
which should not be stored in the Core Data store immediately.
In some cases I want to store the instance later.
Is this possible (simple alloc/init of my NSManagedObject
subclass is not allowed)?
Thanks.
Upvotes: 2
Views: 458
Reputation: 1093
Can I ask why you need to store the object later?
With the information given in your question I would just say: No, it is not possible because, as you say, you should always use the designated initializer of NSManagedObject
From documentation:
NSManagedObject uses dynamic class generation to support the Objective-C 2 properties feature (see “Declared Properties”) by automatically creating a subclass of the class appropriate for entity.initWithEntity:insertIntoManagedObjectContext: therefore returns an instance of the appropriate class for entity. The dynamically-generated subclass will be based on the class specified by the entity, so specifying a custom class in your model will supersede the class passed to alloc.
Upvotes: 2