My code is as follow:
let img = UIImage(named: "in00c.png")
guard let data = CFDataGetBytePtr(img!.cgImage!.dataProvider!.data) else {
fatalError("Couldn't access image data")
}
print(data[0])
it crashes at last line print(data[0])
, due to
EXC_BAD_ACCESS (code=1, address=0x1074e8000)
Does I have something wrong with the code? I am using the latest Xcode, seems it works ok in previous versions.