I used this to create a large image:
let context = CIContext(options: nil)
let bitmapImage: CGImageRef = context.createCGImage(image, fromRect: extent)!
CGContextSetInterpolationQuality(bitmapRef, CGInterpolationQuality.None)
CGContextScaleCTM(bitmapRef, scale, scale);
CGContextDrawImage(bitmapRef, extent, bitmapImage);
let scaledImage: CGImageRef = CGBitmapContextCreateImage(bitmapRef)!
return UIImage(CGImage: scaledImage)
It worked fine in iOS 9 and 10, but not in 8. I got this in the debugger:
Application termination due to an uncaught exception 'NSInvalidArgumentException', reason: '- [CIContext initWithOptions:]: unrecognized selector sent to instance 0x7f868d5dc8e0'
Besides. Instead, I tried to use let context = CIContext(). But in the second line, I got zero. I am using Xcode 8 and Swift 2.3. Please help me with this! Thank!
source
share