我只是CGImageSourceCreateThumbnailAtIndex
用来缩小UIImage
尺寸。我收到崩溃消息:
"IIONumber -- 'num' 不是 CFNumberRef" 。
我找不到它是什么?谢谢
func scaleDownImage()->void{
var nextImage = UIImage()
if let img = nextDicData["img"] as? UIImage{
let data = UIImagePNGRepresentation(img)
if let cgimageSource = CGImageSourceCreateWithData(data! as CFData, nil){
let option : [NSString : Any] = [kCGImageSourceThumbnailMaxPixelSize : self.outputSize, kCGImageSourceCreateThumbnailFromImageAlways : true]
// That's crash at bellow line
if let scaleImage = CGImageSourceCreateThumbnailAtIndex(cgimageSource, 0, option as CFDictionary){
nextImage = UIImage(cgImage: scaleImage)
}
}
}
}