Re: Can't create temporary file
Re: Can't create temporary file
- Subject: Re: Can't create temporary file
- From: Sean McBride <email@hidden>
- Date: Fri, 20 May 2011 15:44:15 -0400
- Organization: Rogue Research Inc.
On Thu, 19 May 2011 22:43:06 -0700, Joar Wingfors said:
>> [[NSData data] writeToURL: myURL options: 0 error: &error];
>
>
>Or:
>
> [[NSFileManager defaultManager] createFileAtPath: path contents: nil
>attributes: nil];
>
>...but yeah, it doesn't take an URL, and it doesn't return an error on
>failure. Good topic for an enhancement request on Foundation IMO.
They appear to have already thought about it, as NSFileManager.h says:
/* These methods are provided here for compatibility. The corresponding
methods on NSData which return NSErrors should be regarded as the
primary method of creating a file from an NSData or retrieving the
contents of a file as an NSData.
*/
- (NSData *)contentsAtPath:(NSString *)path;
- (BOOL)createFileAtPath:(NSString *)path contents:(NSData *)data
attributes:(NSDictionary *)attr;
Oh how I hate how one must always check BOTH the .h and the docs, as
neither says what the other says.
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden