Corebluetooth scanForPeripheralsWithServices method doesn't work for me in any device.all github app doesn't work with my ipod touch devices

I am working on bluetooth related app.but, I have not got any success.

in my application i want to connect iDevice to any other bluetooth device that scans.

but using the CBCentralManager scanForPeripheralsWithServices method, I didn't get any response in the didDiscoverPeripheral method.

The CBCentralManager allocation method is here: -

(void)viewDidLoad
    {
        [super viewDidLoad];

        // Start up the CBCentralManager
        _centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil];

        _textview.userInteractionEnabled = NO; // not used in this test app
    }

      

Scan Method for CBCentralManager: -

(void)scanForPeripherals {
    if (self.centralManager.state != CBCentralManagerStatePoweredOn) {
        NSLog(@"CBCentralManager must be powered to scan peripherals. %d", self.centralManager.state);
        return;
    }

    if (self.scanning) {
        return;
    }

    self.scanning = YES;

    [self.centralManager scanForPeripheralsWithServices:nil options:@{ CBCentralManagerScanOptionAllowDuplicatesKey: @YES }];
    NSLog(@"Scanning started");
}

      

but i never get any response in didDiscoverPeripheral.can method can help me with this code.?

+3


source to share





All Articles