title: Swift fatal error: unexpectedly found nil while unwrapping an Optional value uiimage
body: <p>I've got an error while assign an UIImage to the property image of UIImageView</p>
  
  <pre><code>func connectionDidFinishLoading(connection: NSURLConnection!) {
    var err: NSError
    var jsonResult : NSDictionary = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: nil) as NSDictionary
    println("\(jsonResult)")
    if jsonResult.count &gt; 0 {
      let homepage = jsonResult.objectForKey("homepage") as NSMutableDictionary
      if homepage.count &gt; 0 {
        let imageUrl = homepage.objectForKey("url_img") as NSString
        let backgroundImageUrl = NSURL.URLWithString(imageUrl)
        let backgroundImageData = NSData(contentsOfURL: backgroundImageUrl)
        var image :UIImage = UIImage(data: backgroundImageData)
        println("\(image)")
        self.backgroundImage.image = image
      }
    }
  }
  </code></pre>
  
  <p>It's a delegate function from a get request.
  <code>backgroundImageData</code>and <code>image</code> are not nil but it doesn't work, i don't understand.</p>
  
  <p>I'm a newb with Swift :s</p>
  
  <p>This code work with objective-C</p>
  
  <pre><code>NSString *imageUrl = [metaData objectForKey:@"url_img"];
  NSURL *backgroundImageUrl = [NSURL URLWithString:imageUrl];
  NSData *backgroundImageData = [NSData dataWithContentsOfURL:backgroundImageUrl];
  self.backgroundImage.image = [UIImage imageWithData:backgroundImageData];
  </code></pre>