-
Re: Can the background fetch API be used to initiate an upload operation?
eskimo Dec 7, 2018 1:43 AM (in response to yoursco)Would it be safe/possible to use the background fetch API to check our backend for pending uploads, and then return upload requests (instead of download requests)?
I’m not entirely sure what you’re getting at here, but you seem to be asking whether background fetch requires you to do a download operation. If so, the answer is a very clear “No.” Despite it’s name, background fetch is not connected to the network at all and you can do whatever you want in response to that callback.
Would we be able to write the assets to disk during the
application:performFetchWithCompletionHandler:
callback?Yes, with caveats. When you get the background fetch callback you have a very limited amount of time to do work. By default it’s a few seconds, although you can extend that a little bit using a
UIApplication
background task (see my UIApplication Background Task Notes post for more). If that’s enough time to export your assets, you’re all set. If not, you’ll need to think carefully about how you approach this.Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardwarelet myEmail = "eskimo" + "1" + "@apple.com"