• 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: NSUserDefaults objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSUserDefaults objects


  • Subject: Re: NSUserDefaults objects
  • From: Robert Walker <email@hidden>
  • Date: Wed, 22 Mar 2006 15:16:15 -0500

Chris,

Since you are not allocating or copying the object returned by objectForKey: then you should not be responsible for releasing it.

In this case (as per the memory management documentation) I would assume that I am receiving an autoreleased object. Then I would retain it only if I want to keep a reference to it (like when I store the object in an instance variable).

On Mar 22, 2006, at 2:59 PM, Chris Lewis wrote:

Hi guys, just a quick one:
When I do this:

NSData *colorAsData = [[NSUserDefaults standardUserDefaults]
objectForKey:CFLRecogColor];

What exactly to I get back? Do I get an autoreleased new object or do
I get a reference to an object that already exists? Do I want to
retain/release this?

Thanks!
Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com


This email sent to email@hidden

-- Robert Walker email@hidden



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSUserDefaults objects
      • From: Ondra Cada <email@hidden>
References: 
 >NSUserDefaults objects (From: "Chris Lewis" <email@hidden>)

  • Prev by Date: Re: NSUserDefaults objects
  • Next by Date: Re: newbie question re. cocoa front-end to sql db
  • Previous by thread: Re: NSUserDefaults objects
  • Next by thread: Re: NSUserDefaults objects
  • Index(es):
    • Date
    • Thread