Keep iOS dev app running using Background Modes

244 views Asked by At

I've written a basic FTP Server app in Swift 5 using SwiftUI, it needs to keep a TCP socket listener open waiting for incoming ftp client connections. Ideally I'll keep it running with the phone locked.

I've read you can hijack the Background modes in Swift to run other code, which is fine as this app will never be published - it's for my use only to transfer pics off a DSLR. Someone suggested in a thread to use the Audio mode to play a silent file and that would keep everything running. Does anyone know if what I'm trying to do is possible?

I've added an AVAudioPlayer that just loops a random file and updated Info.plist to add the Audio BG mode, but I think more than this is required as it doesn't appear to be working.

Based off this post it looks like I could maybe use VoIP bg mode? Any input or advice appreciated :)

0

There are 0 answers