Can anyone suggest a solution for downloading multiple files say 100s, in background. The important thing being that the download url has a life span of 15 minutes, so it's required that we fetch a download url and then start downloads. We can't prefetch all urls and add it to download task, as that may lead to download failures of expired url after few successful downloads.
Thanks in advance.
you can do the following:
Explanation
urlFetchedAsString
each time it is setNSData
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0)
means that fetching data from url will be done on the different thread to prevent blocking the UI threaddata
will be set and thedidSet
for this variable will be executed. In this block you can implement your parsing algorithm.Note