I am trying to send AVAudioRecorder in Json , i would like to convert it to NSString or Byte.. any idea?
convert AVAudioRecorder to NSString or bytes
1.2k Views Asked by ohana At
2
There are 2 best solutions below
0

Once you have completed a recording with AVAudioRecorder, you can retrieve the recorded file using your AVAudioRecorder's url
property. Then you can initialize an NSData with the url:
NSData *data = [NSData dataWithContentsOfURL:recorder.url];
To send it as JSON, you need to base64 the data. I recommend this project which has a category for doing this: https://github.com/l4u/NSData-Base64
You'll need to #import "NSData+Base64.h"
into your source and then you can get the base64 string from your NSData by calling base64EncodedString
on it.
Never tried but maybe this ?