rhummelmose / BluetoothKit

Easily communicate between iOS/OSX devices using BLE
Other
2.27k stars 266 forks source link

If appoint service uuid, it could't find real devices. #27

Open pangpingfei opened 8 years ago

pangpingfei commented 8 years ago

Use "centralManager.scanForPeripheralsWithServices(nil, options: nil)", can discovery all device, but use "centralManager.scanForPeripheralsWithServices(configuration.serviceUUIDs, options: nil)", nothing.

This should be the bug of the official.

rhummelmose commented 8 years ago

It will probably take me a month before I get time to look at this. Please provide a PR if you're able to fix the issue.

Nick-The-Uncharted commented 8 years ago

Just make sure your peripheral do boardcasting corresponding service, for example:

let dataServiceUUID = NSUUID(UUIDString: Config.sharedInstance.serviceUUID)!
let characteristicUUID = NSUUID(UUIDString: Config.sharedInstance.infoCharacteristicUUID)!
let config = BKPeripheralConfiguration(dataServiceUUID: dataServiceUUID, dataServiceCharacteristicUUID: characteristicUUID)

try peripheral.startWithConfiguration(config)

If you are not using this lib for advertising , make sure you have this serviceId in CBAdvertisementDataServiceUUIDsKey.

pangpingfei commented 8 years ago

@Nick-The-Uncharted Thanks, but it seems to have no relationship...

Nick-The-Uncharted commented 8 years ago

@pangpingfei Actually I manage to discover my device using this lib in way described above.

rhummelmose commented 8 years ago

@pangpingfei which service UUID are you assigning?

pangpingfei commented 8 years ago

@rhummelmose "05216AFE-02B0-B11E-3B86-60002A5D5C51"

iCodist commented 7 years ago

Why can not BKCentral find nearby Bluetooth devices?

rhummelmose commented 7 years ago

Probably because they are using a different identifier.

iCodist commented 7 years ago

@rhummelmose How to solve this problem?

LazyyNguyen commented 11 months ago

@pangpingfei how you solve this prolem?