On 3 Feb 2010, at 8:08 AM, cocoa-dev wrote:

> I have an app that attaches a file to a document like when you attach a file 
> to mail.  I use the following to store the file as data in an iVar:
> 
> fileData = [NSData dataWithContentsOfURL:url options:NSDataReadingUncached 
> error:(NSError **)errorPtr];

Side issue: If fileData really is an instance variable holding an NSData, you 
almost certainly want to take ownership of it by retaining it. Doing it as 
you're showing here will result in fileData pointing to a released object the 
next time the current NSAutoreleasePool is drained.

If you're using garbage collection, never mind; you're fine.

        — F

_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to