简体   繁体   English

我们使用Xcode 4.5.2在IOS 6上开发蓝牙低功耗。 下载到IOS5设备的应用程序可以连接到BLE设备

[英]We develop Bluetooth Low Energy on IOS 6 with Xcode 4.5.2. The apps downloaded to a IOS5 device can connect to BLE device

We develop Bluetooth Low Energy Apps as Central on IOS 6 SDK with Xcode 4.5.2. 我们使用Xcode 4.5.2在IOS 6 SDK上开发蓝牙低功耗应用程序。 The apps downloaded to a IOS5(IPad3) device can connect to BLE device without problem. 下载到IOS5(IPad3)设备的应用程序可以毫无问题地连接到BLE设备。 However if this apps is to download to a IOS 6 device it will have problem. 但是,如果要将此应用程序下载到IOS 6设备,则会出现问题。 The apps can discover the BLE device(shown on the list) but when we click on to connect, it failed. 应用程序可以发现BLE设备(显示在列表中),但是当我们点击连接时,它就失败了。 We are using the latest IPod5. 我们正在使用最新的IPod5。

I believe this is the iOS 6 bug mentioned here: iOS 6 UUID Problem 我相信这是这里提到的iOS 6 bug: iOS 6 UUID问题

A way to quickly check would be to add an NSLog to check the peripheral name when discovering peripherals. 快速检查的一种方法是添加NSLog以在发现外围设备时检查外围设备名称。

If peripheralName is Null, or if it crashes on CFUUIDCreateString you've found your problem. 如果peripheralName为Null,或者它在CFUUIDCreateString上崩溃,则表示您发现了问题。 The only way that I've found to fix is to connect to the peripheral first [manager connectPeripheral:peripheral options:nil] and then disconnect and reconnect. 我发现修复的唯一方法是先连接外设[manager connectPeripheral:peripheral options:nil]然后断开连接并重新连接。 Once you've done that you should be able to use CFUUIDCreateString without problems. 完成后,您应该可以毫无问题地使用CFUUIDCreateString。

- (void) centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI
{
   if (peripherals.count == 0)
   {
        [peripherals addObject: peripheral];
        NSString *peripheralName;
        peripheralName = [peripheral name];
        NSString *foundDevice = (NSString *)CFBridgingRelease(CFUUIDCreateString(NULL, [peripheral UUID]));
        NSLog(@"Found %@", peripheralName);

I know this sound strange, but also have terrible BLE issues with iPad3 iOS6. 我知道这听起来很奇怪,但iPad2 iOS6也有可怕的BLE问题。 Namely Peripheral name does not reflect changes I introduce in micro-controller's software. 即外围设备名称并不反映我在微控制器软件中引入的更改。

I have iPhone5 with iOS 6.1 beta 4 and iPhone 4s iOS 6.0. 我的iPhone5配有iOS 6.1 beta 4和iPhone 4s iOS 6.0。 Both work flawlessly with my CC2540 projects. 两者都与我的CC2540项目完美配合。

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

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