Swift. Thread running even while being in other apps

0

I need to keep a thread running even when the user is inside another application. I tried the following thread that works only if I keep the application visible, once I press the home button, the thread is paused.

func prepareSync() {
    DispatchQueue.global(qos .background).async {
        self.sync()
        sleep(5)
        self.prepareSync()
    }
}
    
asked by danielctf 12.11.2016 в 20:55
source

1 answer

1

Unfortunately it is not possible, there are only certain types of tasks that you can perform in the background, such as music playback or asynchronous data download but for a short period of time. More info on the official website of Apple developers: Background execution

    
answered by 13.12.2016 в 07:00