title: Why isn't my method getting called?
body: <p>I have a viewController communicating with DownloaderHandler using DownloaderDelegate protocol. </p>
  
  <p>My protocol is defined as:</p>
  
  <pre><code>protocol DownloaderDelegate : class {
  
      func didReceive(data:Data)
  }
  </code></pre>
  
  <p>I have a viewController</p>
  
  <pre><code>class ViewController: UIViewController {
  weak var downloadHandler : DownloaderHandler?    
  
  override func viewDidLoad() {
      super.viewDidLoad()
      downloadHandler = DownloaderHandler()
      downloadHandler?.delegate = self
      changeBackground() 
  
  }
  
   func changeBackground (){
          let googleURL = URL(fileURLWithPath: "https://www.google.com/doodle4google/images/splashes/featured.png")
          print(googleURL)
          downloadHandler?.downloadData(url:googleURL) // Line BB
      }
  }
  
  extension ViewController : DownloaderDelegate{
      func didReceive(data: Data) {
          let image = UIImage(data: data)
          let imageView = UIImageView(image: image!)
          view.insertSubview(imageView, at: 0)
      }
  }
  </code></pre>
  
  <p>And I have a Delegating class as :</p>
  
  <pre><code>class DownloaderHandler : NSObject, URLSessionDelegate{
      weak var delegate :DownloaderDelegate?
      var downloadsSession: URLSession = {
          let configuration = URLSessionConfiguration.default
          let session = URLSession(configuration: configuration)
          return session // Line AA
      }()
  
      func downloadData(url: URL){ // Line CC
          downloadsSession.dataTask(with: url){ data, response, error in
              print("error is \(error), data is \(data) and response is \(response)") // Line DD
  
              if let badError = error {
                  print(" the url didn't succeeed error is \(badError.localizedDescription)")
              }
              else if let someResponse = response as? HTTPURLResponse {
                  if someResponse.statusCode == 200{
                      self.delegate?.didReceive(data: data!)
                  }
              }
  
          }
  
      }
  }
  </code></pre>
  
  <p>Using breakpoints: Line AA, gets loaded. Line BB calls. Line CC never gets called. Why? What am I doing wrong?! </p>