• 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: Problem using bindings with deep key paths
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem using bindings with deep key paths


  • Subject: Re: Problem using bindings with deep key paths
  • From: Quincey Morris <email@hidden>
  • Date: Wed, 20 Jan 2010 15:05:09 -0800

On Jan 20, 2010, at 14:46, Kyle Sluder wrote:

> On Wed, Jan 20, 2010 at 2:37 PM, Gwynne Raskind <email@hidden> wrote:
>> As usual, the blindingly obvious proves to be the problem. I had ensured perfect KVC/KVO compliance, and I was using the compliant accessors everywhere except for one place: the delegate's -awakeFromNib method where I create the Player object in the first place. I declared the property readwrite in the class extension and changed player = [[Player alloc] init] to self.player = [[[Player alloc] init] autorelease], and suddenly it all worked. (Though it vaguely annoys me that I have to add a spurious retain/autorelease to the Player object.)
>
> You don't technically have to. You could do:
>
> [self willChangeValueForKey:@"player"];
> player = [[Player alloc] init];
> [self didChangeValueForKey:@"player"];

... which is unexceptionable, but another alternative might be:

	Player* aPlayer = [[Player alloc] init];
	self.player = aPlayer;
	[aPlayer release];

although (given a couple of contemporaneous threads on the subject of autorelease and its subtleties, and given that I'm sitting smugly on the GC side of the fence) I wouldn't be surprised to find out that the latter suggestion sucks.


_______________________________________________

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

  • Follow-Ups:
    • Re: Problem using bindings with deep key paths
      • From: Gwynne Raskind <email@hidden>
References: 
 >Problem using bindings with deep key paths (From: Gwynne Raskind <email@hidden>)
 >Re: Problem using bindings with deep key paths (From: Quincey Morris <email@hidden>)
 >Re: Problem using bindings with deep key paths (From: Gwynne Raskind <email@hidden>)
 >Re: Problem using bindings with deep key paths (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: Problem using bindings with deep key paths
  • Next by Date: Re: Validating NSXMLDocument against external DTD
  • Previous by thread: Re: Problem using bindings with deep key paths
  • Next by thread: Re: Problem using bindings with deep key paths
  • Index(es):
    • Date
    • Thread