I have an Image : NSManagedObject
that has two properties: NSString* localPath
and NSString* remoteUrl
.
When I save the object by calling save:&error
on the managed object context, I want it to download the file and when the download fails, I want the save operation to fail too.
Because I have a deeply nested DB structure with multiple references to my Image Entity it would be complicated to find all my images to trigger the download manually.
Is this possible, and if so, how can I cancel the save or delete operation so that it fails? If it's bad practice to do this in the Model, where should I do this?