• 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: Where is it better to register with NSNotificationCenter in class?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Where is it better to register with NSNotificationCenter in class?


  • Subject: Re: Where is it better to register with NSNotificationCenter in class?
  • From: Dave Hersey <email@hidden>
  • Date: Tue, 25 Mar 2008 01:31:19 -0400

The other thing I should have mentioned is that when you add items to an array, they are retained, so you don't need to retain each of the strings. I think the problem is probably your missing nil in the object list. The array contents are probably hosed.

It's reasonable to retain the array in this case as you're doing. Otherwise it will be autoreleased.

- d

On Mar 25, 2008, at 1:21 AM, Dave Hersey wrote:
The list for arrayWithObjects needs to end with a nil object.

- d


On Mar 25, 2008, at 1:16 AM, Samvel wrote:
Reason: I thought that at some point NSNotificationCenter has to be instantiated in an application loading process and my constructor may have executed at earlier stage.

Answer: Unfortunately the reason was much simpler than that. It turned out to be an example (answer) to my prev. question regarding memory management. At some point later in my constructor an array is supposed to be created. Basically it has to be a collection of string and I did it this way:
dimensions = [NSArray arrayWithObjects: @"1920x1440",
@"1600x1200",
@"1280x1024",
@"1024x768"];
[dimensions retain];


So, strings are not actually retained. :( and this led to odd behavior.

Samvel.

_______________________________________________

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: 
 >Where is it better to register with NSNotificationCenter in class? (From: Samvel <email@hidden>)
 >Re: Where is it better to register with NSNotificationCenter in class? (From: "Sherm Pendley" <email@hidden>)
 >Re: Where is it better to register with NSNotificationCenter in class? (From: Samvel <email@hidden>)
 >Re: Where is it better to register with NSNotificationCenter in class? (From: Dave Hersey <email@hidden>)

  • Prev by Date: CoreAudio / AudioUnit
  • Next by Date: Re: outlineViewSelectionDidChange not called
  • Previous by thread: Re: Where is it better to register with NSNotificationCenter in class?
  • Next by thread: CoreAudio / AudioUnit
  • Index(es):
    • Date
    • Thread