2017-01-12 54 views
0

我正在開發與audioQueueService 但停止功能「CFURLCreateFromFileSileRepresentation」 這裏是我的代碼,但總是得到零返回。如何用swift使用CFURLCreateFromFileSystemRepresentation?

var path = Bundle.main.path(forResource: "123", ofType: "mp3")! 

var xyz = UInt8(path.utf8CString[0]) 

let audioFileURL =  CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault,&xyz, path.characters.count, false) 

print(audioFileURL) 

我試過帖子路徑指向func但不工作? 任何人都可以幫助我嗎?

+3

該代碼沒有意義。你爲什麼不用'let audioFileURL = Bundle.main.url(forResource:...)'? –

+0

是的,你是對的!我是成癮folowow audioqueueServiceGuide .. – zhujian

回答

0
let url = Bundle.main.url(forResource: "123", withExtension: "mp3")! 

     let audioFileURL = url as CFURL