Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>So you replaced this</p> <pre><code>- (void)doDownload { NSURL *url = [NSURL URLWithString:@"http://foobar.com"]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; connection = [[NSURLConnection alloc] initWithRequest:aURLRequest delegate:self]; receivedData = [[NSMutableData data] retain]; } - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { [_receivedData appendData:data]; } - (void)connectionDidFinishLoading:(NSURLConnection *)connection { NSArray *array = [_receivedData objectFromJSONDataWithParseOptions:JKParseOptionLooseUnicode]; callbackBlock(array); } </code></pre> <p>with this - </p> <pre><code>- (void)doDownload { NSURL *url = [NSURL URLWithString:@"http://foobar.com"]; ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); dispatch_async(queue, ^(void) { [request startSynchronous]; NSArray *array = [[request responseData] objectFromJSONDataWithParseOptions:JKParseOptionLooseUnicode]; // Callback on the main queue to update UI. dispatch_async(dispatch_get_main_queue(), ^(void) { callbackBlock(array); }); }); } </code></pre> <p>and <strong>10,000+ lines of code from ASIHTTPRequest</strong>.</p> <p>What has it got you?</p> <p>NSURLConnection is fully asynchronous, uses GCD, caches, automatic zip/unzip, etc, etc..</p> <p>For that reason, and going solely on the (possibly incomplete) information you provided, i'd say that it was a really awful piece of code.</p> <p>Of course, context is everything - and you may have a really, really, really good reason for reimplementing the already existing functionality of Library code provided by Apple.</p>
 

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