众所周知,在“保存到持久存储”之后,将从其上下文中删除NSManagedObject。我想知道api可以帮我判断它是否被删除。
// MakeupModel is a subclass of NSManagedObject
MakeupModel *model = [MakeupModel MR_findFirstOrCreateByAttribute:@"materialId" withValue:@"221101010"];
model.materialId = model.materialId;
[MakeupModel MR_truncateAll];
[[NSManagedObjectContext MR_contextForCurrentThread] MR_saveToPersistentStoreAndWait];
// Code will crash here because model has beed deleteed whose properties could not be visited. But model is not a "nil" object, how can I judge whether it is deleted? Is there any apis could help?
if(model.materialId) {
}