1

I wrote code in objective c to see available list of nearest present bluetooth device. But there are not show any devices.I shows my code bellow to see and tell where am I wrong. I use iPhone se for testing which install iOS 11.1 and bluetooth version 4.2. My output is:

CoreBluetooth BLE hardware is powered off

refreshPreferences: HangTracerEnabled: 0

refreshPreferences: HangTracerDuration: 500

refreshPreferences: ActivationLoggingEnabled: 0

ActivationLoggingTaskedOffByDA:0

CoreBluetooth BLE hardware is powered on and ready

But after that on screen their is not any device shows My code is follows to call scan peripheral:

- (void)centralManagerDidUpdateState:(CBCentralManager *)central

{
switch (central.state) 

{

 case CBCentralManagerStatePoweredOff:

            NSLog(@"CoreBluetooth BLE hardware is powered off");

            break;

        case CBCentralManagerStatePoweredOn:

            NSLog(@"CoreBluetooth BLE hardware is powered on and ready");

           [self.centralManager scanForPeripheralsWithServices:nil options:nil];

            break;

        case CBCentralManagerStateResetting:

            NSLog(@"CoreBluetooth BLE hardware is resetting");
            break;
        case CBCentralManagerStateUnauthorized:
            NSLog(@"CoreBluetooth BLE state is unauthorized");
            break;
        case CBCentralManagerStateUnknown:
            NSLog(@"CoreBluetooth BLE state is unknown");
            break;
        case CBCentralManagerStateUnsupported:
            NSLog(@"CoreBluetooth BLE hardware is unsupported on this platform");
            break;
        default:
            break;
    }
}

so where did I wrong or any setting will do in iPhone?

Rashed
  • 2,349
  • 11
  • 26
mab
  • 225
  • 3
  • 10
  • 1
    Use `LightBlue.app` (available on the AppStore). Does this one see any device? I guess that at least you implemented the didDiscoverPeripheral and that it isn't called? Did you set the delegate correctly? – Larme Mar 08 '18 at 09:32
  • You can only discover BLE devices advertising a GATT service. As @larme says, use LightBlue to confirm that there is a BLE peripheral to be discovered. – Paulw11 Mar 08 '18 at 10:28

0 Answers0