CFStringRef

Crowd-sourced documentation and tutorials by the Cocoa developer community
Jump to: navigation, search

Apple's documentation: http://developer.apple.com/documentation/CoreFoundation/Reference/CFStringRef/Reference/reference.html


Thanks to TollFreeBridging a CFStringRef is equivalent to an NSString

// Casting a CFStringRef to an NSString object: CFStringRef cfString; NSString nsString = (NSString)cfString;

// Casting an NSString object pointer to a CFStringRef: NSString nsString; CFStringRef cfString = (CFStringRef)nsString;

But don't forget to call CFRelease on CFStringRefs created using CoreFoundation methods when you're done with it! eg. CFStringCreate(...) An example is when converting PascalString's to NSString's, as only CoreFoundation methods exist to do so.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox