I just use CGImageSourceCreateThumbnailAtIndex
to scale down UIImage
size . I get crash Message :
"IIONumber -- 'num' is not a CFNumberRef" .
I could not find what is it? Thanks
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)
}
}
}
}