iOS蓝牙开发 - Central模式
Central模式
中心模式(Central Model),可以简单理解为设备App作为中心,连接其他蓝牙外设设备。区别于外设模式,官方介绍可自行Google。这里主要介绍iOS上蓝牙设备作为中心模式的集成。
功能集成
作为蓝牙使用者,程序需要请求蓝牙设备授权,在info.plist配置文件中,添加代码:
1 | </array> |
项目Targets对应的 BuildPhases 中,引入 CoreBluetooth.framework ,使用的代码中引入头文件
1 | #import <CoreBluetooth/CoreBluetooth.h> |