zhangchong_fan
2016-03-01 06:38iOS app如何连接 已经与手机配对好的蓝牙设备
NSUUID *uuid = [[NSUUID alloc]initWithUUIDString:@"F0010001-0451-4000-B000-000000000000"];
NSArray *bleArray = [NSArray arrayWithObjects:uuid, nil];
NSArray *retrivedArray = [centralManager retrieveConnectedPeripheralsWithServices:bleArray];
for (CBPeripheral *peripheral in retrivedArray) {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
self.testPeripheral = peripheral;
[centralManager stopScan];
[centralManager connectPeripheral:peripheral options:nil];
NSLog(@"%@",peripheral.services);
peripheral.delegate = self;
[peripheral discoverServices:nil];
});
NSLog(@"peripheral:%@",peripheral);
}
我用上边的方法获取到了设备可是就是连接不起来,请高手帮忙回答一下
- 点赞
- 回答
- 收藏
- 复制链接分享
2条回答
为你推荐
- iOS CoreBluetooth蓝牙搜索没有搜索到需要的蓝牙设备?
- 蓝牙
- ios
- corebluetooth
- 2个回答
- ios 获取蓝牙配对信息
- 蓝牙
- 设备
- 2个回答