Cocoa methods that return CF objects

Jon Gotow gotow at stclairsoft.com
Fri Jul 4 08:12:57 PDT 2008


At 11:09 AM +0200 7/4/08, Christiaan Hofman wrote:
>Yes, but also this document does tell me the relevant bit of what 
>I'd want to know. I am pretty sure it's incomplete, as I'm sure any 
>function accepting CFType (and that's more than CFRelease and 
>CFRetain) can accept also any Cocoa object (NSObject). Otherwise the 
>standard collection callbacks would break and, if I'm not mistaken, 
>those are used by Cocoa's collection classes.

In general, most of these classes are "toll-free bridged" - ie. they 
may be substituted for one another, and release/CFRelease are 
interchangeable (except when GC is on).  There are a few, however, 
that aren't interchangeable, such as NSBundle/CFBundle (see 
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/Reference/Reference.html). 
I believe the basics, such as retain/release will still work on the 
*Bundle classes, but I don't assume I can truly treat a CFType as an 
NSObject unless the docs say that they're "toll-free bridged", in 
Apple's terminology.

  - 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