我选择带有IOBluetoothDeviceSelector的IOBluetoothDevice。在那之后,我用设备做了一些事情;没关系。
当设备足够接近时,是否可以保存IOBluetoothDevice并自动连接? (重启应用程序后)
谢谢!
答案 0 :(得分:0)
IOBluetoothDevice
有以下方法对您有用:
- [IOBluetoothDevice addressString]
,它会为您提供设备地址作为字符串,您可以轻松存储在您的应用默认值中。
+ [IOBluetoothDevice deviceWithAddressString:(NSString*) address]
将允许您在应用重新启动后使用该地址字符串构建IOBluetoothDevice*
。
- [IOBluetoothDevice openConnection]
或- [IOBluetoothDevice openConnection:(id)delegate]
,可以同步或异步打开与您创建的设备的连接。