Hi all,
I have an app which uses sockets (from the iNetwork library) to communicate with another device over WiFi. Some of the messages received from the other device can cause local notifications to be raised on the iPhone running the app, or the app to send responses back to the other device.
When running the app in debug mode through B4i Bridge, there are no problems – the app will send response messages or raise notifications as expected, no matter if the app is in background, or with the iPhone's screen switched off. However, when I uploaded the app to the iOS App Store and downloaded it from there, I found that the behaviour is very different: whenever the app is not in foreground (e.g. returned to the Home screen, switched to another app, or the phone screen off), the app won't respond at all. Only when the app becomes foreground again, will the expected response/notification occur.
I can't find any reason for this behaviour, and I'm finding it hard to do any in-depth testing as it only occurs in the release version. Is there anything that can be done about the app (or possibly socket?) becoming unresponsive while in background? In B4A, I managed to find a workaround for a similar issue (probably caused by Android's "doze" feature) by setting the relevant Service to be a Foreground Service, but have so far drawn a blank with this problem on iOS.
Thanks,
Dave