I am trying to get raw data from microphone on my real test phone not simulator but when I run below code I got this error
AddInstanceForFactory: No factory registered for id <CFUUID 0x6000017bba00> F8BB1C28-BAE8-11D6-9C31-00039315CD46
func getVoice() {
let audioEngine = AVAudioEngine()
let inputNode = audioEngine.inputNode
let bus = 0
//let format = AVAudioFormat(commonFormat: AVAudioCommonFormat.pcmFormatInt16, sampleRate: 16000.0, channels: 1, interleaved: false)
inputNode.installTap( onBus: 0, // mono input
bufferSize: 1000, // a request, not a guarantee
format: nil, // no format translation
block: { buffer, when in
// This block will be called over and over for successive buffers
// of microphone data until you stop() AVAudioEngine
let actualSampleCount = Int(buffer.frameLength)
// buffer.floatChannelData?.pointee[n] has the data for point n
var i=0
while (i < actualSampleCount) {
let val = buffer.floatChannelData?.pointee[i]
// do something to each sample here...
i += 1
}
})
do {
try audioEngine.start()
} catch let error as NSError {
print("Got an error starting audioEngine: \(error.domain), \(error)")
}
}




