I'm working on a voice calling app for iOS in Swift and I need to enable auto detection and auto connection of wireless(bluetooth) headsets/earpeaces.
I'm using AVAudioSession RouteChangeReason but it's not detecting when airpods or some other wireless headset is connected via bluetooth. After connecting the device I can even see it in Bluetooth settings that it's connected, but the device is not listed in MPVolumeView as you can see in the screenshoot.
I've been looking for an answer on how to work this out all over the internet and even though there are a lot of similar questions here on StackOverFlow none of them is specifically related to my case so please give me a light on how to solve this.
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.