AVAudioRecorder/AVAudioSession with Apple Airpods
Turns out the issue we were having had to do with the category that was being set. Due to issues we were having with various Bluetooth output devices we set and keep the audio category set to AVAudioSessionCategoryPlayback
except when we're ready to record.
Per this Stack post: AVAudioSession: Some Bluetooth devices are not working properly on my App
In the above code we switch the category over to AVAudioSessionCategoryRecord
before we're about to record. While this works for the builtin mics and other bluetooth devices it did not work with AirPods. Instead, setting the category to AVAudioSessionCategoryPlayAndRecord
allows recording to work with the AirPods.
I then still maintain a Playback only category for the session throughout the app for audio playback. Only switching to PlayAndRecord when about to record audio.
As a side note: Apple does not list the AirPods as an MFi device.
https://mfi.apple.com/MFiWeb/getFAQ.action#1-1
AVAudioSession.RouteChangeReason not detecting connected bluetooth headset/earphones
I just read the code and finally found what was wrong with it. The problem was that I was setting the category more than once so for some reason this was causing wireless headset/earpeace to not connect directly to the app.
Related Topics
How to Return Value from Alamofire
Upload Image With Parameters in Swift
Adjust Uilabel Height Depending on the Text
How to Apply a Perspective Transform to a Uiview
Getting Error "No Such Module" Using Xcode, But the Framework Is There
Can You Animate a Height Change on a Uitableviewcell When Selected
How to Make Http Request in Swift
Check For Internet Connection With Swift
How to Debug Memory Leaks When Leaks Instrument Does Not Show Them
How to Get Device Make and Model on Ios
Nsnotificationcenter Addobserver in Swift
Library? Static? Dynamic? or Framework? Project Inside Another Project
Converting String to Int With Swift
How to Set Cornerradius For Only Top-Left and Top-Right Corner of a Uiview