I record and save an audio file, this works and plays in the app as expected. After the recording, however, I try to load it so I can pass the audio into a JSON object, but can't open it.
I get the following error:
The file “audio.m4a” couldn’t be opened because the text encoding of its contents can’t be determined.
This is call I'm making:
do {
let audioData = try NSData(contentsOfFile: String(contentsOf: audioURL!))
} catch {
print error
}
Any ideas how I can load the audio data as from the file in base64 encoding?
Thanks