Unable to get destinationURL data in connectionDidFinishDownloading for ios5

余生颓废 提交于 2019-12-03 11:19:45
Julien

NSURLConnectionDownloadDelegate only works for Newstand apps so far. Please file a bug.

You could try to use NSURLConnectionDataDelegate instead. It won't show up in the docs, but it's actually there (use Open Quickly to find it Cmd+Shift+O).

There you could use following methods

  1. - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
  2. - (void)connectionDidFinishLoading:(NSURLConnection *)connection

iIf NSURLConnectionDownloadDelegate methods present in you class, NSURLConnectionDataDelegate will not be called. Watch out! – jAckOdE Thanks to a comment in Erik Aigner's answer below.

Basically... The NSURLConnectionDownloadDelegate overrides NSURLConnectionDataDelegate. Beware!!! :)

vishal
– (void)connection:(NSURLConnection *)connection didReceiveData:(NSData*)data

Above method is used to receive the data which we get using post method.

– (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error

This method , you can use to receive the error report in case of connection is not made to server.

– (void)connectionDidFinishLoading:(NSURLConnection *)connection

The above method is used to process the data after connection has made successfully.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!