如果蓝牙设备已配对,我需要将蓝牙耳机的呼叫音频路由转移到iPhone设备,反之亦然。
任何帮助将不胜感激?
答案 0 :(得分:0)
以下是用于在iOS中以编程方式将呼叫音频路由从蓝牙耳机更改为iPhone扬声器的代码集
MPAVRoutingController* routingController = [[MPAVRoutingController alloc] init];
[routingController setDiscoveryMode:1];
[routingController fetchAvailableRoutesWithCompletionHandler: ^{
NSMutableArray* arr = [[NSMutableArray alloc] init];
for (MPAVRoute* route in [routingController availableRoutes]) {
[arr addObject:route];
}
NSPredicate* predicate = [NSPredicate predicateWithFormat: @"routeUID contains %@", @"Speaker"];
NSArray* val = [arr filteredArrayUsingPredicate:predicate];
if ([val count] > 0) {
[routingController pickRoute:val[0]];
}
}];
使用的API是Apple Private API的