I’m trying to remove the background from the UIImageView. I use DeepLabV3 Library, it's working on my device or simulator there is no problem here.
When I send to a new build on TestFlight, its only crashes on the TestFlight version.
I don’t understand the problem, I tried to some changes and research on the other source but I can’t get any solution.
Deployment Info: IOS15
here is a screenshot of the error: error image
here is the code:
// modified from https://developer.apple.com/documentation/coreimage/applying_a_chroma_key_effect
private func chromaKeyFilter() -> CIFilter? {
let size = 64
var cubeRGB = [Float]()
for z in 0 ..< size {
let blue = CGFloat(z) / CGFloat(size-1)
for y in 0 ..< size {
let green = CGFloat(y) / CGFloat(size-1)
for x in 0 ..< size {
let red = CGFloat(x) / CGFloat(size-1)
let brightness = getBrightness(red: red, green: green, blue: blue)
let alpha: CGFloat = brightness == 1 ? 0 : 1
cubeRGB.append(Float(red * alpha))
cubeRGB.append(Float(green * alpha))
cubeRGB.append(Float(blue * alpha))
cubeRGB.append(Float(alpha))
}
}
}
let data = Data(buffer: UnsafeBufferPointer(start: &cubeRGB, count: cubeRGB.count))
let colorCubeFilter = CIFilter(name: "CIColorCube", parameters: ["inputCubeDimension": size, "inputCubeData": data])
return colorCubeFilter
}
Thanks for your help :)