EAAccessoryDidConnectNotification不会触发,直到Bluetooth Accessory Picker完成块被调用
我最近开始使用EAAccessoryManager
showBluetoothAccessoryPickerWithNameFilter
方法来连接到我们的MFI蓝牙配件(如果它还没有连接),当我们的应用程序启动。 我遇到了以下情况:
- 配件断电
- 用户启动应用程序
- 显示配件选取器
- 用户开启附件(之前已配对,因此重新连接)
- 附件选取器继续显示,应用程序不会收到
EAAccessoryDidConnectNotification
直到用户按下“取消”EAAccessoryDidConnectNotification
附件选取器。
在上面解释的情况下,即使我们连接到由NSPredicate
定义的附件,拾取器NSPredicate
挂起,在调用拾取器完成块之前,我们不会收到附件已连接的通知。 用户有点陷入僵局。
我们正在运行iOS 7.1.1并且已经针对7.1和7.0进行了testing。
任何帮助,将不胜感激。 这里有一些日志显示我所看到的:
2014-04-28 12:03:48.028 App[508:60b] BTM: attaching to BTServer 2014-04-28 12:03:48.262 App[508:60b] BTM: setting pairing enabled 2014-04-28 12:03:55.578 App[508:60b] BTM: attempting to connect to service 0x00000001 on device "Accessory-10" 00:07:80:79:92:8D 2014-04-28 12:03:55.966 App[508:60b] BTM: connection to service 0x00000001 on device "Accessory-10" 00:07:80:79:92:8D succeeded 2014-04-28 12:03:55.991 App[508:60b] BTM: attempting to connect to service 0x00000080 on device "Accessory-10" 00:07:80:79:92:8D 2014-04-28 12:03:56.024 App[508:60b] BTM: connection to service 0x00000080 on device "Accessory-10" 00:07:80:79:92:8D succeeded 2014-04-28 12:04:06.845 App[508:60b] BTM: setting pairing disabled 2014-04-28 12:04:06.847 App[508:60b] BTM: disabling device scanning 2014-04-28 12:04:06.856 App[508:60b] __46-[LoginViewController selectBluetoothDevice]_block_invoke Error: Error Domain=EABluetoothAccessoryPickerErrorDomain Code=2 "The operation couldn't be completed. (EABluetoothAccessoryPickerErrorDomain error 2.)" 2014-04-28 12:04:06.928 App[508:60b] EAAccessoryDidConnectNotification 2014-04-28 12:04:06.935 App[508:60b] Accessory connected!