I have built an iOS app which exchanges data with a device using Bluetooth Low Energy (BLE) which is a Core Bluetooth framework.
When the app is in background, even though the device has sent data to the iPhone, the BLE framework is not sending this data to the app.
When the app comes to foreground it receives all the data that was sent when the app was in background. This means that iPhone's Bluetooth layer received the data but it just stored the data and delivered to the app when the app came to foreground.
This is not always issue. This is happening at random order.
// application went to background
2019/04/13 11:54:38:174 BLEManager# applicationDidEnterBackground
2019/04/13 11:54:38:176 BLEBackgroundTaskManager# applicationDidEnterBackground
// application receives data when it comes to foreground although this data was sent from device at 11:54:40:256
2019/04/13 12:39:36:149 CentralManager# Value received is <02>
The expected result is that didUpdateValueForCharacteristic
will be called when data is received but when the app is in background this API is not being called. This API is being called when the app comes to foreground.