Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>According to the <a href="http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/URLLoadingSystem/Tasks/UsingNSURLConnection.html" rel="nofollow">programming guide</a>, a connection "can be canceled any time before the delegate receives a connectionDidFinishLoading: or connection:didFailWithError: message by sending the connection a cancel message".</p> <p>so why not try moving </p> <pre><code> [connection cancel]; </code></pre> <p>from the <code>connectionDidFinishLoading</code> method to just after your <code>if-else</code> block in the <code>didReceiveResponse</code> delegate method? You want to cancel the "checkHeaders==YES" connection in either case; either you're about to kick off a new connection, or you already know all you need to know about the current connection.</p> <p>UPDATED as requested:</p> <pre><code> if (![lastModifiedString isEqualToString:savedString]) { [self downloadNewFile]; } else { // you've already implicitly checked for equality above UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Ingen uppdatering tillgänglig" message:@"Det finns ingen uppdatering att hämta just nu." delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alert show]; [alert release]; } // you've used the connection for everything that you need, so cancel it in either case [connection cancel]; </code></pre> <p>as <code>downloadNewFile</code> kicks off its <code>NSURLConnection</code> asynchronously, this should be okay in the event that the two strings are equal. Slightly safer would be to move the <code>cancel</code> method call to just prior to the <code>if-else</code> check.</p>
    singulars
    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.
 

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