2 zhangchong fan zhangchong_fan 于 2016.03.01 14:38 提问

iOS 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个回答

caozhy
caozhy   Ds   Rxr 2016.03.08 12:02
xgcyangguang
xgcyangguang   2016.04.23 09:25
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!