'Swift Core Bluetooth - discoverServices - What happens if no service can be found?
I'm working with Core Bluetooth in Swift and I'm wondering what happens after I called discoverServices([myServiceUUIDs]) in case that no services that are matching can be found.
The connect(_ peripheral: CBPeripheral, options: [String: Any]? = nil) has didConnect and didFailToConnect. So I have a case that gets called if it fails.
But on discoverServices() the documentation says only
When the peripheral discovers one or more services, it calls the peripheral(_:didDiscoverServices:) method of its delegate object.
So in the "happy case" that it finds the services I can continue doing stuff. But how do I know that it can't find any services? Is there also a method for or do I have to use a Timer and just cancel after a defined time and assume that there is not the service I was looking for?
Solution 1:[1]
It keeps looking until you turn it off. You have to use a timer or give the user a button to stop searching (or both.)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Daniel T. |
