After making the changes for toll-free bridging, a CFStringRef is backed by an Objective-C NSCFString. Creating one from ObjC as NSString works perfectly. Creating one from C using CFStringCreateWithCString() works fine, but CFShowStr() thinks it is a NSString. Ironic, since it will display the variant created with [NSString stringWithCString:] just fine.
--- Native objects ---
OBJC: createInstance(NSString_placeholder 0x10844a568 0) = 0x7f934dc069e0
OBJC: createInstance(NSCFString 0x10844a450 25) = 0x7f934dc06e50
+ NSCFString(0x10844a450): 0x10000078c 0x6163666f6f6c6615 0x61636e61796e2074 0x1
bits: flags 78c, rc 1
Length 25 # <----- this is CFShowStr(NSString *)
IsEightBit 1
HasLengthByte 0
HasNullByte 0
InlineContents 0
Allocator 0x7f934dc06e10
Mutable 0
Contents 0x7f934dc06e90
This is an NSString, not CFString # <-----this is CFShowStr(CFStringRef)!
After making the changes for toll-free bridging, a CFStringRef is backed by an Objective-C NSCFString. Creating one from ObjC as NSString works perfectly. Creating one from C using
CFStringCreateWithCString()works fine, butCFShowStr()thinks it is a NSString. Ironic, since it will display the variant created with[NSString stringWithCString:]just fine.