title: NSURLSession for network images download+cache
body: <p>There are many third parties libraries for loading a network image and then store it into a disk and/or memory.</p>
  
  <p>However it is <strong>very easy</strong> to implement it using simple NSURLSession API call.</p>
  
  <p>here is the code:</p>
  
  <pre><code>     NSURLCache *myCache = [[NSURLCache alloc] initWithMemoryCapacity: 16384 diskCapacity: 268435456 diskPath: cachePath]; // these numbers are only for the usage example.
       defaultConfigObject.URLCache = myCache;
       defaultConfigObject.requestCachePolicy = NSURLRequestUseProtocolCachePolicy;
       _session = [NSURLSession sessionWithConfiguration: defaultConfigObject delegate:self delegateQueue: [NSOperationQueue mainQueue]];
  
       _dataTask = [_session dataTaskWithURL:url completionHandler:^(NSData *data, NSURLResponse *response, NSError *error){
  
          if (!error){
              UIImage* theImage = [UIImage imageWithData:data];
              dispatch_async(dispatch_get_main_queue(), ^{
                  self.image = theImage;
  
              });
          }
      }];
      [_dataTask resume];
  </code></pre>
  
  <p>This code downloads an image(from a given url) and store it to memory+disk according to the http caching policy.</p>
  
  <p>Deriving MyNetworkImageView from UIImageView and adding the above code to a setURL: method, is also straight forward. </p>
  
  <p><strong>My question is</strong>: </p>
  
  <p>What are the advantages of using other third parties frameworks such as AFNetworking,FastImageCache,SDWebImage,SDImageCache?</p>