Requirement Description The app operates as a central device. It connects to a Bluetooth peripheral via Core Bluetooth. Once connected, the peripheral enables a Wi-Fi hotspot. The app joins this hotspot and transfers data over a TCP connection. The app needs to remain active in the background until this TCP data transfer is complete. Question Regarding the Proposed Solution One proposed approach is to have the peripheral send periodic BLE notifications (reporting transfer progress) to the app, using each notification to briefly wake the app and extend its background execution time. Would this method successfully keep the TCP connection alive in the background until the transfer finishes? Does it comply with App Store review guidelines? Request for Alternative Solutions If this approach is not viable, could you advise on any supported mechanisms or recommended architectures that would allow a local Wi-Fi TCP data transfer to complete reliably after the app moves to the background?
Keeping a Local Wi-Fi TCP Transfer Alive in the Background Using Bluetooth Notifications — Is This Viable?
I don’t work for App Review and can’t give you definitive answers about their policies.
So, focusing on the technical only…
Would this method successfully keep the TCP connection alive in the background until the transfer finishes?
The issue here isn’t the TCP side of things. In general, TCP connections work in the background as long as your app doesn’t get suspended. So, if you’re set up to avoid that, think of something like a music streaming app, then TCP is fine.
Rather, the issue here is Wi-Fi. iOS has a complex Wi-Fi lifecycle and it’s not clear how that will affect your product. If you think about a music streaming app, eventually iOS will leave the Wi-Fi network and the app will transition to using WWAN. That’s fine for it, but it’d be a showstopper for your app.
I have a bunch of info about the iOS Wi-Fi lifecycle in the various posts hanging off Extra-ordinary Networking.
And with that in mind, I have question about this:
the peripheral enables a Wi-Fi hotspot.
I’d like to clarify what you mean by hotspot. Does that Wi-Fi network lead to the wider Internet? Or are you using it solely so that the iOS device can join and thus communicate with your accessory?
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"