I'm trying to get UIProgressView, NSURLConnection, NSOperation and NSOperationQueue working together. Here is the code: http://pastie.org/4080576
Problem:
connection:DidReceiveData:
never called: execution going immediately to -start()
, through -main()
, then to -connection:DidReceiveResponse:
, back to -main()
(sometimes), and finally to -connectionDidFinishDownloading:destinationURL:
.
When I trying to download picture from this link:
http://upload.wikimedia.org/wikipedia/commons/4/41/Kharkov_picture_1787.jpg
I get this output:
2012-06-13 19:43:06.189 downloadingFilesInOpQueue[5070:f803] Received response: 2012-06-13 19:43:06.190 downloadingFilesInOpQueue[5070:f803] Filesize is: 3075638 Suggested filename is: Kharkov_picture_1787.jpg 2012-06-13 19:43:12.476 downloadingFilesInOpQueue[5070:f803] Finished downloading. Received 0 bytes
Also, I can't figure out where connection:didReceiveResponse:
belong:
NSURLConnectionDelegate or NSURLConnectionDataDelegate.
P.S. If there some style issues, I would glad to hear about them. Thx.