-objectWithID: is supposed to give me an object that's broken when the ID doesn't exist. The documentation says, that this object throws an exception when I try to access an property.
However, it never throws any. Must I enable exceptions so that they're really thrown?
Here's some code:
// Assume: a new managed object has been created. Then it's ID has been converted to NSURL.
// The MO has been saved. Then the NSURL has been converted back to an NSManagedObjectID *tmpID
// So tmpID is an ID that doesn't exist anymore, since the ID of the MO has changed due to persisting it
@try {
NSManagedObject *mo = [context objectWithID:tmpID]; // tmpID doesnt exist anymore!
NSString *timeStamp = [[mo valueForKey:@"timeStamp"] description]; // nil
[mo setValue:[NSDate date] forKey:@"timeStamp"];
}
@catch (NSException * e) {
NSLog(@"Error: %@: %@", [e name], [e reason]); // never called
}