iosswiftapp-storebackground-processswift-nio

Appropriate background mode for Swift NIO client


I've created an iOS app, that connects to an embedded device using swift-nio-ssh. This app has no UI to control the device, as that is supposed to be done with a Watch app, using WatchConnectivity.

As it stands, I have to keep the iOS app in the foreground or the SSH client will die after a few seconds. Instead I'd like to be able to keep the proxy app running in background, screen locked or whatever else the user wants to do with their iPhone.

I've done research on background modes, but none of the available APIs seem to fit my use case.

  1. Have I overlooked something?
  2. If not, would I be able to abuse another API instead (Audio, VoIP or NetworkExtension from what I've gathered)?
  3. If so, would the app still be able to pass the review process somehow?

Thanks!


Solution

  • You haven't overlooked something and this applies to everything, not just SwiftNIO-using apps. On iOS, if an app goes into the background then it will be stopped and network connections will die at some point.

    The only way around that are the mainly VoIP exceptions you mention in (2) which you have to specifically request from Apple.