title: How is a strong retain cycle possible with async or static calls?
body: <p>I am trying to grasp how I can recognize when a strong retain cycle is possible and requires me to use <code>[weak/unowned self]</code>. I've been burned by unnecessarily using <code>[weak/unowned self]</code> and the self was deallocated immediately before giving me a chance to use it.</p>
  
  <p>For example, below is an async network call that refers to <code>self</code> in the closure. Can a memory leak happen here since the network call is made without storing the call it self into a variable?</p>
  
  <pre><code>NSURLSession.sharedSession().dataTaskWithURL(NSURL(string: url)!) {
    (data, response, error) in
    self.data = data
  )
  </code></pre>
  
  <p>Here's another example using the NSNotificationCenter, where a call can be made later asynchronously:</p>
  
  <pre><code> NSNotificationCenter.defaultCenter().addObserverForName(
          UIApplicationSignificantTimeChangeNotification, object: nil, queue: nil) {
              [unowned self] _ in
              self.refresh()
      }
  </code></pre>
  
  <p>My question is in what cases is a strong retain cycle possible? If I am making an asynchronous call or static call that references self in a closure, does that make it a candidate for <code>[weak/unowned self]</code>? Thanks for shedding any light on this.</p>