0
fatal error: unexpectedly found nil while unwrapping an Optional value

I have the above error and I'm trying to hack together a solution.

@IBOutlet var imageView: UIImageView?

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
    let url = NSURL(fileURLWithPath: "https://upload.wikimedia.org/wikipedia/commons/thumb/c/c2/Faust_bei_der_Arbeit.JPG/220px-Faust_bei_der_Arbeit.JPG");
    let imageData: NSData? = NSData(contentsOfURL: url)
    let image = UIImage(data: imageData!)
    imageView?.image = image
}
User
  • 23,729
  • 38
  • 124
  • 207

0 Answers0