In the ios12 beta, our app crashes. We need to access some attributes from the current context, below are some codes:
public override func draw(_ frame: CGRect) {
let context = UIGraphicsGetCurrentContext()!
let imgData = unsafeBitCast(context.data, to:UnsafeMutablePointer<CUnsignedChar>.self)
let bitmapWidth = context.bytesPerRow * 8 / context.bitsPerPixel
}
It crashes because context is not type CGBitmapContext, it's kCGContextTypeUnknown. So all the methods for bitmap return 0 or nil. It's quite confusing, all the previous iOS version works properly. I haven't found any document on this change so far. Can anyone help?