YES, it will work (but it's a terrible practice). The retrievePeripherals:
method was specially created so that you can reconnect to peripherals between subsequent launches of the application. You can use your method, but as soon as the application shuts down, you can never reconnect to the periphery (without putting it in advertising mode and starting from scratch basically). You can save the uuid between runs, but you cannot save the CBPeripheral
object. So there is a big flaw.
So, to summarize: it will work, but it really wonβt bring anything. This is no faster than calling retrievePeripherals:
and then connecting them. Your suggested method limits your connectivity in CoreBluetooth
. But, nevertheless, an interesting question.
source share