Unknown process name- vImageConvert_AnyToAny - failed on beginBackgroundTask

228 Views Asked by At

Hey So i am resizing my images on a background thread that keeps executing after the app entered the background with beginBackgroundTask along with some other code like so:

func resizeImage(image: UIImage, newWidth: CGFloat) -> UIImage {
  let scale = newWidth / image.size.width
  let newHeight = image.size.height * scale
  UIGraphicsBeginImageContext(CGSize(width: newWidth, height: newHeight))
        
  image.draw(in: CGRect(x: 0, y: 0, width: newWidth, height: newHeight))
  let newImage = UIGraphicsGetImageFromCurrentImageContext()
  UIGraphicsEndImageContext()
  return newImage!
} 

When I trigger the resize and go back to the home screen then I get a bunch of the following errors. But if I let it run in the foreground it runs flawlessly.

[Unknown process name] vImageConvert_AnyToAny - failed width = 0 height = 1 dst component = 8bit integer dstLayout = ByteOrder32Little dstBytesPerRow = 0 src component = 8bit integer srcLayout = ByteOrderDefault srcBytesPerRow = 0

When I set a breakpoint I can't say for certain that my resize logic is spitting out these errors but it has to be because vImageConvert_AnyToAny is a low level image api that is probably called by UIGraphicsGetImageFromCurrentImageContext or draw.

How do I get rid of these errors ?

0

There are 0 best solutions below