I recently migrated my app to Swift 3 and Xcode 8.

The imageView didn't show the image if I re-open the app.

I used viewWillAppear() for this function. The code is as below:

let imageUrl: NSURL = NSURL(string: "\(userDefaults.string(forKey:
"avatar_url")!)")!
let imageData:NSData = NSData(contentsOf: imageUrl as URL)!
let logo = UIImage(data: imageData as Data)!
self.logoImage.image = logo

Any thoughts?

Thanks in advance.

Yue Cui
_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev

Reply via email to