1.获取音频文件路径
例如:
NSURL *recordedFile = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:
[NSString stringWithFormat: @"%.0f.%@", [NSDatetimeIntervalSinceReferenceDate] * 1000.0, @"caf"]]];
2.将音频文件转成NSData
NSData *soundData = [[NSData alloc] initWithContentsOfURL:recordedFile];
3.将NSData转成base64的NSString类型
NSString *sound=[soundData base64EncodedString];