小编Vis*_*ani的帖子

scanForPeripheralsWithServices:options:指定服务时无法连接

使用scanForPeripheralsWithServices:选项时,我可以在使用时发现服务

// Scanning with nil services will return all devices.
NSLog(@"Looking for any service.");
[self.centralManager scanForPeripheralsWithServices:nil options:nil];
Run Code Online (Sandbox Code Playgroud)

但是,当使用通过以下代码从蓝牙设备获得的服务标识符预先指定服务时,我无法发现该设备.

#define DEVICE_INFO_SERVICE_UUID @"180a"
NSArray *services = [NSArray arrayWithObjects:[CBUUID UUIDWithString:DEVICE_INFO_SERVICE_UUID], nil];

[self.centralManager scanForPeripheralsWithServices:services options:nil];
Run Code Online (Sandbox Code Playgroud)

怎么了?

objective-c core-bluetooth bluetooth-lowenergy ios7

5
推荐指数
1
解决办法
9528
查看次数