In Core Bluetooth, after connecting to a device, I turn off the device and the device is disconnected. But when I turn on the device again, there is no didDiscoverPeripheral called again. How can I reconnect to the device again?
In Core Bluetooth, after connecting to a device, I turn off the device and
Share
When you disconnect a device with
cancelPeripheralConnectionthedidDisconnectPeripheraldelegate method will be invoked. However from iOS 6.0 the device remains connected for about 40-50 seconds (or more), so nodidDiscoverPeripheralwill be invoked in that timeframe. If you want to “discover” it again just call theretrieveConnectedPeripheralsmethod and you will get the reference indidRetrieveConnectedPeripherals.However, the best solution is to save the device’s UUID and use that to reconnect with the
retrievePeripheralsmethod. This will invokedidRetrievePeripheralsand you can reconnect withconnectPeripheral. This is the fastest way to reconnect to a device, no scanning is required in this case.