Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS task when application is closed

I am building an app which uploads files to the server via ajax. The problem is that users most likely sometimes won't have the internet connection and client would like to have the ajax call scheduled to time when user have the connection back. This is possible that user will schedule the file upload when he's offline and close the app. Is it possible to do ajax call when the application is closed (not in background)? When app is in the background, we can use background-fetch but I have never faced a problem to do something when app is closed.

like image 261
Tukkan Avatar asked Feb 07 '16 13:02

Tukkan


1 Answers

The short answer is no, your app can't run code after being terminated.

You can run code in your AppDelegate's applicationWillTerminate, but that method is mainly intended for saving user data and other similar tasks.

See this answer also.

like image 177
xoudini Avatar answered Oct 12 '22 21:10

xoudini