Background
I have an iOS app which scans for BLE devices in the Background. It worked well until I updated to iOS12. This is what I have:
- App is configured to run in Background (e.g. location & bluetooth-central keys in .plist)
- App is supposed to run continuously in Background, scanning for Peripherals. This is not to be confused with Background Fetch, which is a different use case.
- App does not connect to Peripherals. It only reads the advertisement packets.
- App gets suspended after running for a few hours in the Background.
- App resumes normal operation when brought to the Foreground
- App operated properly in iOS 11. Problems started after updating to iOS 12.x
I placed log messages in the App Delegate methods. This last thing I see is the app entering Background State. I never see a call to applicationWillTerminate()
, as it is only called when the app is in the Foreground.
I have seen other posts (e.g. iOS 12 terminates apps in the background for no reason) for similar behavior with the Location stack. Using the test app written by the author of the post, I verified the problem has been fixed in iOS 12 for Location Services. But the BLE problems persist.
Has anyone found a workaround for this problem?
thanks in advance.