如何检测开启蓝牙的Iphone/Ipad设备?

如何检测开启蓝牙的Iphone/Ipad设备?,iphone,objective-c,ios5,bluetooth,Iphone,Objective C,Ios5,Bluetooth,我正在使用BluetoothManager.framework 我有一个检测iphone/ipad蓝牙设备的示例。但此示例应用程序未检测到我的设备 下面是示例代码和url的链接: 如果您有任何关于检测蓝牙设备的建议或示例,我们将不胜感激。您的蓝牙设备使用哪种类型的蓝牙?蓝牙4.0?如果是的话,使用CoreBooth框架可能会更好,尤其是它不是私有的。 使用蓝牙,您必须创建CBCentralManager实例。然后必须实现CBCentralManagerDelegate协议和CBPeripher

我正在使用BluetoothManager.framework

我有一个检测iphone/ipad蓝牙设备的示例。但此示例应用程序未检测到我的设备

下面是示例代码和url的链接:


如果您有任何关于检测蓝牙设备的建议或示例,我们将不胜感激。

您的蓝牙设备使用哪种类型的蓝牙?蓝牙4.0?如果是的话,使用CoreBooth框架可能会更好,尤其是它不是私有的。
使用蓝牙,您必须创建CBCentralManager实例。然后必须实现CBCentralManagerDelegate协议和CBPeripheraldegate协议。您可以通过询问CBCentralManager状态来测试硬件是否支持Bluetooth 4.0。例如:CBCentralRangerState Unsupported表示您的硬件不支持BT 4.0

我有两部iPhone使用相同的蓝牙,但没有相互连接。即使设备的版本相同,蓝牙也是相同的。在这种情况下,您可以使用bluetooth 4.0。使用iOS 6,iPhone还可以安装蓝牙外围设备,如心脏监护仪。有关详细信息以及如何实现蓝牙4,请从Apple下载。
BluetoothManager *btManager;

- (IBAction)scanButtonAction
{
  if ([btManager enabled])
  {
        // start scan
        [btManager  setDeviceScanningEnabled:YES];
   }
   else
   {
    showMessage(@"Error", @"Turn Bluetooth on first!");
   }

}

- (IBAction)bluetoothON
{
    NSLog(@"bluetoothON called.");
    [btManager setPowered:YES];
    [btManager setEnabled:YES]; 
}

- (IBAction)bluetoothOFF
{
    NSLog(@"bluetoothOFF called.");
    [btManager setEnabled:NO]; 
    [btManager setPowered:NO];
}