• 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: KVC and Core Foundation types
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: KVC and Core Foundation types


  • Subject: Re: KVC and Core Foundation types
  • From: Graham Cox <email@hidden>
  • Date: Fri, 01 Feb 2013 16:53:35 +1100

On 01/02/2013, at 4:08 PM, Kyle Sluder <email@hidden> wrote:

> But CFTypes *are* NSObjects. So I'm not sure why your case isn't working. Can you be more specific?


This is why the result surprised me - I have "known" this for years, and assumed that there wouldn't be a problem with this. But, this is the first time I've ever actually tried it, and what I found is that if I have a property, e,g

@property (nonatomic, assign) CGColorRef		myColor;

and I ask for this using

[someObject valueForKey:@"myColor"];

then instead of returning the object, it hits -valueForUndefinedKey: instead.

While that gives me an opportunity to do something to wrap or convert the object, I must admit it wasn't the expected behaviour. I have been through all the KVC documentation and I could find nothing that stated explicitly whether CFTypes can be accessed via KVC; the lack of mention could imply that they can't be, or alternatively, that they can be... ;-)

Incidentally, while I declare these properties as 'assign', they do in fact retain, it's just that the property synthesizing mechanism doesn't allow me to specify retain for these types. Instead I have to implement the setter manually and perform the necessary retains/releases as needed. Perhaps this is a clue? Again, I would have thought that the system would 'know' that a CFType is an NSObject, and permit the use of retain in the property declaration.

--Graham


_______________________________________________

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: KVC and Core Foundation types
      • From: Roland King <email@hidden>
References: 
 >KVC and Core Foundation types (From: Graham Cox <email@hidden>)
 >Re: KVC and Core Foundation types (From: Seth Willits <email@hidden>)
 >Re: KVC and Core Foundation types (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: KVC and Core Foundation types
  • Next by Date: Re: KVC and Core Foundation types
  • Previous by thread: Re: KVC and Core Foundation types
  • Next by thread: Re: KVC and Core Foundation types
  • Index(es):
    • Date
    • Thread