iPhone无法与配对的蓝牙低能耗设备

时间:2015-08-04 07:07:43

标签: ios objective-c iphone bluetooth-lowenergy

我遇到了iPhone问题。一步一步我的问题:

  1. 我发现,连接并将我的iPhone配对(绑定)到BLE设备。

  2. 经过一些特殊的沟通后,我手动离开应用程序并断开连接。

  3. 问题。当我尝试再次配对和通信时,这是不可能的,因为iPhone显示"连接"或者不是 连接"设备"我的设备"设置部分。当我尝试 在应用程序中搜索设备iPhone无法找到任何东西,因为 iPhone就像已经找到的设备一样。

  4. 如何解决这个问题?因为现在唯一的办法是忘记设备中的设备(从"我的设备"手动删除),然后才可以配对和连接..

    编辑:

         - (void)centralManagerDidUpdateState:(CBCentralManager *)central {
              if (central.state == CBCentralManagerStatePoweredOn) {
                   [self scanForPeripherals];
               }
          }
    
        - (int)scanForPeripherals {
            NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
                                     [NSNumber numberWithBool:NO], CBCentralManagerScanOptionAllowDuplicatesKey,
                                     nil];
    
            //NSLog(@"%@",@[[CBUUID UUIDWithString:TRANSFER_SERVICE_UUID]]);
    
            [self.centralManager scanForPeripheralsWithServices:nil options:options];
            return 0;
          }
    
        - (void)centralManager:(CBCentralManager *)central didConnectPeripheral:(CBPeripheral *)peripheral {
            NSLog(@"didConnectPeripheral");
    
                // Clear the data
                [self.data setLength:0];
    
                // Discover callbacks
                peripheral.delegate = self;
    
                [peripheral discoverServices:@[[CBUUID UUIDWithString:TRANSFER_SERVICE_UUID]]];
        }
    

0 个答案:

没有答案