如题,ble加了ancs后,通过app能够连接并配对成功。如果用户关闭app,再次打开会搜索不到蓝牙设备。这时候要连接该怎么办?大牛们有没有做过ancs的,提供下思路。
解决方案 »
- 我下载了2个rar文件Xcode4.2_1_rar和Xcode4.2_1_rar,请问怎么安装Xcode啊,没有运行程序.exe安装的吗
- TdCalendarView控件如何获取点击事件
- 请问如何通过手机获取的经纬度判断当前时区?
- 关于objective-c 类目(Category),遇到的问题新手求助!
- 保存数据sqlite 还是property list
- .net转ios开发,公司需要没办法,希望有人能把经验分享一下,谢谢csdn平台!
- 二维码扫描安装是如何实现的
- iOS 开发文档 用什么工具制作?
- 学MJ的汤姆猫视频遇到imageWithContentsOfFile问题。。
- 微信支付sdk 回调区分支付逻辑的问题 求大神看看
- ios 如何检查是否设置代理
- sonarqube 分析objective-c 代码时,为什么无法检测出问题
NSArray *retrivedArray = [delegate.sensor.manager retrieveConnectedPeripheralsWithServices:bleArray];
NSLog(@"retrivedArray:\n%@",retrivedArray);
for (CBPeripheral* peripheral in retrivedArray) { // 只有一个配对的设备,暂时不考虑多个
// [delegate.sensor connect:peripheral];
[delegate.sensor.manager connectPeripheral:peripheral options:@{CBConnectPeripheralOptionNotifyOnDisconnectionKey:[NSNumber numberWithBool:TRUE]}];
NSLog(@"peripheral:%@",peripheral);
}
执行后会看到2015-12-19 17:32:07.753 AncsDemo[546:232404] retrivedArray:
(
"<CBPeripheral: 0x14f57d8f0, identifier = 7626B77E-5633-D09B-5C2A-0A022D4D61D8, name = ble_demo, state = disconnected>"
)
2015-12-19 17:32:07.753 AncsDemo[546:232404] peripheral:<CBPeripheral: 0x14f57d8f0, identifier = 7626B77E-5633-D09B-5C2A-0A022B1D61D7, name = ble_demo, state = connecting>