iOS之蓝牙开发—何时触发(CBCentralManager *)central didFailToConnectPeripheral:(CBPeripheral *)peripheral方法
来源:互联网 发布:国产动画 知乎 编辑:程序博客网 时间:2024/06/11 05:32
经过整个下午的调试,总算清楚何时会触发 - (void)centralManager:(CBCentralManager *)central didFailToConnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error 方法。
当调用手机连接外设的方法: - (void)connectPeripheral:(CBPeripheral *)peripheral options:(nullable NSDictionary<NSString *, id> *)options;,作为中心设备的手机会和硬件之间建立连接,但是建立连接也是需要一定时间的,具体的时间是多少我并没有测算出来,肯定是很短暂的,但也不是微乎其微。
就在这短暂的时间内,如果调用手机和外设断开的代理方法: - (void)cancelPeripheralConnection:(CBPeripheral *)peripheral; 那么就会进入连接失败的代理方法之中: - (void)centralManager:(CBCentralManager *)central didFailToConnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error;
/*!
* @method centralManager:didFailToConnectPeripheral:error:
*
* @param central The central manager providing this information.
* @param peripheral The <code>CBPeripheral</code> that has failed to connect.
* @param error The cause of the failure.
*
* @discussion This method is invoked when a connection initiated by {@link connectPeripheral:options:} has failed to complete. As connection attempts do not
* timeout, the failure of a connection is atypical and usually indicative of a transient issue.
*
*/
苹果官方给出的解释是由{@link connectPeripheral:options:}发起的连接没有完成,就会调用。
- iOS之蓝牙开发—何时触发(CBCentralManager *)central didFailToConnectPeripheral:(CBPeripheral *)peripheral方法
- iOS - 蓝牙库CoreBluetooth核心内容之central
- CBCentralManager 蓝牙
- CBCentralManager、CBPeripheral等简要理解DEMO
- IOS CoreBluetooth系列二:实战之本地 Central 和远程 Peripheral
- IOS CoreBluetooth系列三:实战之远程 Central 和本地 Peripheral
- ios蓝牙开发学习笔记(三)peripheral角色的实现
- ios蓝牙开发学习笔记(五)与peripheral通信的最佳实践
- ios蓝牙开发学习笔记(六)作为Peripheral端的最佳方式
- iOS蓝牙调用的一般流程-CBPeripheralManagert和CBCentralManager
- Android - BlueTooth BLE 之 Central 与 Peripheral 理解
- iOS开发之-Grand Central Dispatch
- iOS之蓝牙开发
- CBCentralManager 蓝牙透传
- iOS CBPeripheral和CBPeripheralDelegate
- ios开发之何时用delegate,何时用notification?
- ios开发之何时用delegate,何时用notification?
- ios开发之蓝牙编程
- ImageLoader源码解析
- 反射 动态代理与AOP
- 全局变量、局部变量、静态全局变量、静态局部变量的区别
- 在linux服务器上远程调试jprofiler最方便的方法
- Lasso Regression
- iOS之蓝牙开发—何时触发(CBCentralManager *)central didFailToConnectPeripheral:(CBPeripheral *)peripheral方法
- inline内联函数之深度解析
- c++中函数的介绍(第七章)
- SVN使用遇到的问题
- 宽度自适应布局
- 安装flume的步骤
- mybatis框架入门(一)
- FileSystemView获取一些简单目录
- 工作流引擎Activiti使用总结