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