这是我编码的方式:
let url:NSURL = NSURL(string : pictURL)!
let imageData : NSData = NSData.init(contentsOf: url as URL)!
let str64 = imageData.base64EncodedData(options: .lineLength64Characters)
// next line my code to save in core data just ignore it
encoded data = 3286 bytes
的值。我认为这是错误的
let pictEncoded = person.value(forKeyPath: "pictureurl") as! String
if let imageData = Data(base64Encoded: pictEncoded, options: .ignoreUnknownCharacters),
let image = UIImage(data: imageData)
{
cell.imgView.image = image
}