我如何从swift中的本机swift String或NSString创建一个CFString
let path:String = NSBundle.mainBundle().pathForResource(name.stringByDeletingPathExtension,ofType:"pdf") let string:CFString = ??? path let url:CFURLRef = CFURLCreateWithFileSystemPath(allocator:kcfAllocatorDefault,filePath:string,pathStyle:CFURLPathStyle.CFURLPOSIXPathStyle,isDirectory:false)
只是投下它:
var str = "Hello,playground" as CFString NSString(format: "type id: %d",CFGetTypeID(str))