Mac:自动连接到IOBluetoothDevice

时间:2012-02-29 15:38:01

标签: macos bluetooth

我选择带有IOBluetoothDeviceSelector的IOBluetoothDevice。在那之后,我用设备做了一些事情;没关系。

当设备足够接近时,是否可以保存IOBluetoothDevice并自动连接? (重启应用程序后)

谢谢!

1 个答案:

答案 0 :(得分:0)

IOBluetoothDevice有以下方法对您有用:

- [IOBluetoothDevice addressString],它会为您提供设备地址作为字符串,您可以轻松存储在您的应用默认值中。

+ [IOBluetoothDevice deviceWithAddressString:(NSString*) address]将允许您在应用重新启动后使用该地址字符串构建IOBluetoothDevice*

- [IOBluetoothDevice openConnection]- [IOBluetoothDevice openConnection:(id)delegate],可以同步或异步打开与您创建的设备的连接。

相关问题