I am trying to write a fast iOS application that will record the voice of users. I wrote the following code in swift, however it does not ask for microphone permission from the user. It is imprinted, but it never records audio, and in the settings panel in privacy mode, it does not display the application. How to request write permissions in swift?
var session: AVAudioSession = AVAudioSession.sharedInstance() session.requestRecordPermission({(granted: Bool)-> Void in if granted { println(" granted") session.setCategory(AVAudioSessionCategoryPlayAndRecord, error: nil) session.setActive(true, error: nil) self.recorder.record() }else{ println("not granted") } })
ios swift avaudioplayer avaudiorecorder avaudiosession
Bdgapps
source share