如何将swift字符串转换为CFString

前端之家收集整理的这篇文章主要介绍了如何将swift字符串转换为CFString前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我如何从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))

猜你在找的Swift相关文章