Re: Help with NSData dataWithContentsOfURL
Re: Help with NSData dataWithContentsOfURL
- Subject: Re: Help with NSData dataWithContentsOfURL
- From: Fritz Anderson <email@hidden>
- Date: Wed, 3 Feb 2010 12:00:03 -0600
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@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