I want to download many images around 300, and display it in the UI.
I have two questions:
If the app is in foreground, and suppose user sends it to background mode(by clicking on home button) then how do I assure the download to continue?
If the user force quits the app(doubleclick on home button and swipe the app from app switcher), then how do I ensure the app downloads the images?
I've been reading about background stuffs a lot. Few also say that in 2. case the download cannot continue.
Below are the links I referred:
http://www.appcoda.com/ios7-background-fetch-programming/ http://www.appcoda.com/background-transfer-service-ios7/ iOS Background downloads when the app is not active
I'm not getting the right approach to download the images in foreground, background/suspended, user force quits the app. I'm using AFNetworking for webservice calls.
Below is my code:
I've image details like the URL in .json file uploaded to amazon. To download the file I do,
[NSData dataWithContentsOfURL:[NSURL URLWithString:@"https://someurl/imageFile.json"]];
From this file I read the urls of images and download them along with image details. This is a big process. How Do I handle it? Please help..
Solution for your 1 question is below :
Add below code in your AppDelegate:
For your 2 solution