How to record an audio file in .mp3 format?
The Problem is kAudioFormatMPEGLayer3
which is not supported by AVAudioRecorder
.
Alternatively you can use kAudioFormatAppleIMA4
for your recording purpose.
Finally you can write your own encoding logic to convert kAudioFormatAppleIMA4
in to MP3
Format.
The other supported encoding for Recording purpose are
kAudioFormatMPEG4AAC kAudioFormatAppleLossless kAudioFormatAppleIMA4 kAudioFormatiLBC kAudioFormatULaw kAudioFormatLinearPCM
For more info you can refer to this post of SO.