如何从文档目录访问音频文件?

How to access audio file from document directory?

我在文档目录中存储了一个音频文件,现在我需要获取该音频文件并执行一些操作 encryption/Decryption。 我想要的完全是这样:

let audiofile = get audio file from document directory // This is what i want

encrypt(audiofile)// I have AES technique, This is not my question.

很简单!!!

就像下面的代码::

var paths: [AnyObject] = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)

let audiofilePath = paths[0].stringByAppendingString("/myaudio.mp3")

//Write name of your audio at **myaudio.mp3**

//now you can use anywhere audiofilePath as String like

let audiourl : NSURL = NSURL((fileURLWithPath: audiofilePath))

//or you can make asset like

let assets = AVAsset(URL: NSURL(fileURLWithPath: audiofilePath))

享受编码,如果需要任何帮助,请问我..