Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Each NSURLDownload represents a single downloading instance. You're probably trying to reuse the same one multiple times. It's an inherently asynchronous system that already used background threads. Here's an example based on Apple's sample code:</p> <pre><code> - (void)startDownloadingURL:sender { // Create a couple requests. NSURLRequest *requestOne = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.apple.com"] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0]; NSURLRequest *requestTwo = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://stackoverflow.com"] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0]; // Create two download instances NSURLDownload *downloadOne = [[NSURLDownload alloc] initWithRequest:requestOne delegate:self]; NSURLDownload *downloadTwo = [[NSURLDownload alloc] initWithRequest:requestTwo delegate:self]; if (downloadOne) { // Set the destination file. [downloadOne setDestination:@"/tmp" allowOverwrite:YES]; } else { // inform the user that the download failed. } if (downloadTwo) { // Set the destination file. [downloadTwo setDestination:@"/tmp" allowOverwrite:YES]; } else { // inform the user that the download failed. } } - (void)download:(NSURLDownload *)download didFailWithError:(NSError *)error { // Release the connection. [download release]; // Inform the user. NSLog(@"Download failed! Error - %@ %@", [error localizedDescription], [[error userInfo] objectForKey:NSErrorFailingURLStringErrorKey]); } - (void)downloadDidFinish:(NSURLDownload *)download { NSLog(@"The download %@ has finished.", download) // Release the download connection. [download release]; } </code></pre> <p>If you attempt to use the same NSURLDownload for both NSURLRequests, then it will kill the previous connection.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload