gpt4 book ai didi

ios - 如何将所有 MFI 设备列出到 iOS 应用程序中?

转载 作者:可可西里 更新时间:2023-11-01 03:26:56 49 4
gpt4 key购买 nike

我想在 iOS 设置中显示之前未配对的所有通过 MFI 的苹果设备的列表。

我可以使用以下代码列出已连接的设备:

NSArray *accessories = [[EAAccessoryManager sharedAccessoryManager]

connectedAccessories];

所以我的查询是:

  1. 我能否使用 iOS 应用程序中的“外部配件”框架扫描所有可用的未配对 MFI 设备,然后我可以从 iOS 应用程序将它们配对。

请帮我缩短它。

提前致谢......

最佳答案

是的,你可以。

从 iOS 6 开始,EA Framework 在应用程序中提供了内置的蓝牙配对功能。

检查这个:

[[EAAccessoryManager sharedAccessoryManager] showBluetoothAccessoryPickerWithNameFilter:nil completion:^(NSError *error) {

}];

您还可以使用过滤器参数来过滤您的设备。

But remember, if you send or receive data from device via MFI, you may need to add protocol string into Info.plist on "Supported external accessory protocols"

编辑:

好的,我会一步一步列出MFI世界。

1.What above code is doing?

它会弹出一个小的 tableView 来显示所有可用的蓝牙设备。

2.How to pair?

只需单击表格中显示的单元格。它会自动连接到设备。

3.How to identify device is paired or not?

检查下面的代码,你应该明白它是什么。

[[EAAccessoryManager sharedAccessoryManager] showBluetoothAccessoryPickerWithNameFilter:nil completion:^(NSError *error) {
if (error) {
NSLog(@"error :%@", error);
}
else{
NSLog(@"You make it! Well done!!!");
}
}];

4.Notification connect or disconnect?

检查以下通知。

EAAccessoryDidConnectNotification
EAAccessoryDidDisconnectNotification

MFI有很多东西可以研究,所以最好通过Apple文档和示例代码来深入了解它。

关于ios - 如何将所有 MFI 设备列出到 iOS 应用程序中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20654123/

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