Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have problem. I scan with central.scanWithDuration, but I get nil error. Can you help me please? Why?
My code:`
private var discoveries = [BKDiscovery]() let central = BKCentral() func central(_ central: BKCentral, remotePeripheralDidDisconnect remotePeripheral: BKRemotePeripheral) { print("DidDisconnect") } func availabilityObserver(_ availabilityObservable: BKAvailabilityObservable, availabilityDidChange availability: BKAvailability) { if availability == .available { print("start scan") scan() } else { central.interruptScan() } } func availabilityObserver(_ availabilityObservable: BKAvailabilityObservable, unavailabilityCauseDidChange unavailabilityCause: BKUnavailabilityCause) { print("CauseDidChange") } override func viewDidLoad() { super.viewDidLoad() tableView.delegate = self tableView.dataSource = self startCentral() } private func startCentral() { do { central.delegate = self central.addAvailabilityObserver(self) let dataServiceUUID = UUID(uuidString: "6E6B5C64-FAF7-40AE-9C21-D4933AF45B23")! let dataServiceCharacteristicUUID = UUID(uuidString: "477A2967-1FAB-4DC5-920A-DEE5DE685A3D")! let configuration = BKConfiguration(dataServiceUUID: dataServiceUUID, dataServiceCharacteristicUUID: dataServiceCharacteristicUUID) try central.startWithConfiguration(configuration) } catch let error { print("Error while starting: \(error)") } } private func scan() { central.scanWithDuration(7, progressHandler: { newDiscoveries in print(newDiscoveries) }, completionHandler: { result, error in print("errorScan \(error)") print(result) }) }`
The text was updated successfully, but these errors were encountered:
Check the example please :)
The example also returns an error
I have problem. I scan with central.scanWithDuration, but I get nil error. Can you help me please? Why?
My code:`
The text was updated successfully, but these errors were encountered: