CoreBluetooth LE,
, , BluetoothHFP:
1. AVAudioSeesion:
link AVFoundation.framework
2. :
NSArray *availInputs = [[AVAudioSession sharedInstance] availableInputs];
3. :
. AVAudioSession
. AVAudioSessionRouteChangeNotification
- (BOOL)prepareAudioSession {
BOOL success = [[AVAudioSession sharedInstance] setActive:NO error: nil];
if (!success) {
NSLog(@"deactivationError");
}
success = [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionAllowBluetooth error:nil];
if (!success) {
NSLog(@"setCategoryError");
}
success = [[AVAudioSession sharedInstance] setActive:YES error: nil];
if (!success) {
NSLog(@"activationError");
}
return success;
}
, :
[self prepareAudioSession];
NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter];
[defaultCenter addObserver:self
selector:@selector(bluetoothAvailabilityDidChange:)
name:@"BluetoothConnectabilityChangedNotification"
object:nil];
- , Audio AirPlay :

!! ,