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 s...@rogue-research.com Rogue Research www.rogue-research.com Mac Software Developer Montréal, Québec, Canada _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com