How can I detect whether an HFP or A2DP is connected in iOS?
问题 I am working on a project which can play music via HFP device. But here's a problem that I want to detect whether an HFP or A2DP is connected when music is playing. Now I am using the AVFoundation framework to do this. Here's the code: - (BOOL)isConnectedToBluetoothPeripheral { BOOL isMatch = NO; NSString* categoryString = [AVAudioSession sharedInstance].category; AVAudioSessionCategoryOptions categoryOptions = [AVAudioSession sharedInstance].categoryOptions; if ((![categoryString