简体   繁体   English

无法使用showBluetoothAccessoryPickerWithNameFilter获取附件列表

[英]Unable to get accessory list using showBluetoothAccessoryPickerWithNameFilter

I am developing an iOS application which using external accessory framework to communicate with hardware device. 我正在开发一个iOS应用程序,该应用程序使用外部附件框架与硬件设备进行通信。

Problem : 问题:

[[EAAccessoryManager sharedAccessoryManager]showBluetoothAccessoryPickerWithNameFilter:nil
                                                                             completion:nil];

Above method always return empty list. 上面的方法总是返回空列表。 I have seen a lot links and questions but didn't find any solution. 我看到了很多链接和问题,但没有找到任何解决方案。

Supported external accessory protocols is already added to info.plist 支持的外部附件协议已添加到info.plist

Could any one have idea about it? 有人对此有想法吗? It would be appreciate. 不胜感激。

I know this is old, but for those who stumbled across, make sure to: 我知道这很古老,但是对于那些偶然发现的人,请确保:

Add the protocols in your Info.plist 在您的Info.plist添加协议

<key>UISupportedExternalAccessoryProtocols</key>
<array>
    <string>com.protocol.test</string>
    <string>com.apple.p1</string>
</array>

And enable "Background Modes" from "Your Project" > "Capabilities" > "Background Modes". 并从“您的项目”>“功能”>“背景模式”中启用“背景模式”。 Then check " External accessory communication ". 然后检查“ 外部附件通讯 ”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM