The app is downloading a file (plist) which is generated by the server. The server takes a loooong time to generate the file, so I would like to be able to show progress (probably view UIProgressView, but that's not important).
Since the file I'm downloading hasn't been created yet at the beginning of the request, we don't know the expectedContentLength
. However, I have the means to provide progress updates from the [PHP] script itself. I'm using ob_flush()
for each line in the file to do this, which works just fine in a browser.
But when I make the request from the app, I'm only getting a call from connection:didReceiveData:
after the script has finished executing, so that's not of much use.
So my question boils down to this:
How can I tap into the progress of such a php script from my app?
I wouldn't mind sending 2 requests to the server, the first that generates the file and provides updates while doing so, and then another to download the actual file.
Since none of my NSUrlConnection delegate methods are being called until the request completes, what does my script need to do to trigger these methods?