ios - 使用私有(private)框架 BluetoothManager/iOS 5.0

标签 ios frameworks bluetooth iphone-privateapi

我可以在私有(private)框架的帮助下启用蓝牙。

现在我必须搜索附近的设备。 我想 deviceScanningEnabled 命令是正确的,但我如何获得返回的设备?有回调函数吗?我读到一些将在 NotificationCenter 中的通知?!

我该如何在这种情况下使用它?

最佳答案

据我所知,蓝牙管理器会在操作系统过滤结果后获取列表 - 这意味着您只会获取附近的耳机设备,而不是所有通用设备。如果您需要查找所有通用设备,则必须使用@rajagp 的答案。

如果找到耳机就足够了,那么你可以按照你说的使用通知;发现设备的通知称为“BluetoothDeviceDiscoveredNotification”。您首先需要列出通知:

[[NSNotificationCenter defaultCenter] 
    addObserver: self
    selector: @selector( your_discovery_method_name)
    name: @"BluetoothDeviceDiscoveredNotification"
    object: nil];

“your_discovery_method_name”是您编写的显示/接受通知的方法。它看起来像这样:

-(void) your_discovery_method_name:(NSNotification *) notification {
     self.device = [notification object];

     NSLog(@"found: %@",self.device.address);
     // ...
}

设备来自 BluetoothDevice 类型。

关于ios - 使用私有(private)框架 BluetoothManager/iOS 5.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8620953/

相关文章:

ios - 在 Swift 中动画绘制圆圈的奇怪问题

ios - 在 Xcode 的 Framework 中使用 Objective c 和 Swift

ios - iOS PKPKT BLE概念

ios - 如何绘制一个点(Swift)

ios - 如何提高渲染图像的性能?

ios - 重新下载 iOS 开发证书

像 BluePrint/960gs 这样的 HTML5+CSS3 框架?

c# - 通过配置加载依赖程序集

android - 在android中发现可用的蓝牙设备

ios - 多点连接 - 使用 pin