I'm trying to understand the meaning of the value returned by [NSData writeToFile:options:error:]. The method returns a BOOL, which according to Apple's documentation is "YES if the operation succeeds, otherwise NO."
Fair enough, but if it's NO, I would have assumed that the error parameter would then be set to some retrievable NSError* value. However in results I'm coming across, that's not the case. Accordingly I'm somewhat confused, and don't know how to determine what caused the failure.
To wit, I've got this code (more or less):
NSError* error = nil;
BOOL success = [data writeToFile: filePath error: &error];
if ( error )
NSLog( @"error = %@", [error description] );
success
turns out to be NO
in the code I'm running, but the NSLog
statement is never executed. How come?
Howard