I am after a little advice on background/foreground session usage. The documentation states that by default, background sessions are used for uploads and download. As I understand it, this means that the transfer can complete even if the app is no longer running. You can optionally use foreground sessions instead, but then you lose the ability to transfer when the app is suspended or quit.
In my case, I am only uploading/downloading small files (as part of a data syncing strategy). This is mainly done in the foreground when the user adds data to the app. If the user comes out of the app, then the app asks for more time to complete any data transfers (using the beginBackgroundTaskWithName app delegate method). This is typically sufficient for the small size of the data involved.
So would I be better off setting sessions to run in the foreground? The only downside I can see if that if the app is quit or the network connection is lost, then the transfers will not complete. However the syncing code is designed to check for incomplete transfers and try again when the app is restarted, which should mitigate against this.
I am a little wary of background transfers since I am not sure how it behaves if the transfer is completed when the app is not running (and therefore my syncing code it not there to control it)...