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);
}
我用上边的方法获取到了设备可是就是连接不起来,请高手帮忙回答一下