how to retrieve audio file from parse swift

孤街浪徒 提交于 2019-12-02 01:51:29
David Jirman

Checking the official documentation it should look something like this (I don't use Swift so please bear with me):

audioFile.getDataInBackgroundWithBlock{ (audioFile: NSData?, error:NSError?) -> Void in
    if error == nil {
        let path = "path-to-your-file"
        if !audioFile.writeToFile(path, atomically: true){
            print("Error saving")
        }
    }
}

I would recommend to go through some tutorials (e.g. here) where you might get better examples of file handling in Swift.

Update

Apparently both the block's parameters have to be optionals (see here). Your result block needs to be of type (audioFile: NSData?, error: NSError?)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!