• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Help with NSData dataWithContentsOfURL
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Help with NSData dataWithContentsOfURL (From: cocoa-dev <email@hidden>)

  • Prev by Date: Re: Multithread communication
  • Next by Date: NSFont to CGFontRef
  • Previous by thread: Re: Help with NSData dataWithContentsOfURL
  • Next by thread: Multithread communication
  • Index(es):
    • Date
    • Thread