Cocoa methods that return CF objects

Julien Jalon jjalon at gmail.com
Sat Jul 5 02:35:42 PDT 2008


Yes: *any*

They might not be bridged to a "well known" class but any CFType  
instance can be used as an ObjC object (and more precisely as an  
NSObject subclass)

Implementation-wise, try [(id)aCFobject class] on whatever instance  
you have. You will get some NSCFXXX (NSCFString, NSCFArray, etc.)  
class and if there is no obvious bridged class (eg. CFBundle,  
CGContext and most of CG objects, QLThumbnailRequest, etc.), you will  
get the very generic NSCFType class (of course, all of this is an  
implementation detail you should not have to care about)

-- 
Julien

Sent from my iPhone

Le 5 juil. 08 à 04:44, Jon Gotow <gotow at stclairsoft.com> a écrit :

> At 2:49 AM +0200 7/5/08, Julien Jalon wrote:
>> Any CFType instance is toll free bridged to an instance of some  
>> NSObject subclass and any NSObject or subclass instance can be used  
>> as a CFType instance. This is part of Core Foundation design  
>> concepts. While the documentation could be clearer on this subject.
>
> This applies to _any_ CFType instance?  I've been "playing it safe"  
> by only assuming that objects explicitly documented as being toll- 
> free bridged were safe to treat as both a CFType or NSObject  
> subclass (that was what I was saying in my first reply - if a class  
> is documented as being toll-free bridged, the implication is that - 
> release and CFRelease will both work without issue, but I don't  
> assume that if there are distinct, non-miscible implementations,  
> like with NSBundle and CFBundle).
>
> - Jon
>
> -- 
> ________________________________________________________________________
 

>        Jon Gotow                     gotow at stclairsoft.com
>   St. Clair Software              http://www.stclairsoft.com/
>    Fax (540)552-5898               ftp://ftp.stclairsoft.com/


More information about the MacOSX-dev mailing list