gpt4 book ai didi

ios - 如何使用 ExternalAccessory.framework 获取蓝牙设备列表

转载 作者:行者123 更新时间:2023-11-28 19:17:40 25 4
gpt4 key购买 nike

如何使用 ExternalAccessory.framework 获取蓝牙设备列表,而不是使用核心蓝牙框架 Gamekid 框架。请给我写代码示例

最佳答案

External Accessory framework 只能获取 list apple devices...By Apple

The External Accessory framework is designed to allow iOS applications to communicate only with hardware accessories that are developed under Apple's MFi licensee program. MFi compliant accessories can be implemented as wired devices, meaning they plug in to the iOS device's 30-pin connector, or as wireless devices, whereby they use Bluetooth as the communication channel. Either way, an application that uses the External Accessory framework will not be notified of an accessory's presence unless the accessory identifies itself as being MFi compliant, i.e., it was specifically designed to interface with an iOS application.

如果你只想获取列表苹果设备使用示例代码

NSArray *accessories = [[EAAccessoryManager sharedAccessoryManager] 
connectedAccessories];
for (EAAccessory *obj in accessories)
{
NSLog(@"Found accessory named: %@", obj.name);
}

您必须在应用的 Info.plist 文件中包含 UISupportedExternalAccessoryProtocols 键。

<key>UISupportedExternalAccessoryProtocols</key>

此键包含一个字符串数组,用于标识您的应用支持的通信协议(protocol)。

关于ios - 如何使用 ExternalAccessory.framework 获取蓝牙设备列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11202161/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com