Post

Replies

Boosts

Views

Activity

Reply to Unabe to use writeHEIFRepresentation - failed to add image to the PhotoCompressionSession.
@DTS Engineer Thanks for the info on the logging. Here is the error: -[CIContext(ImageRepresentation) _CMPhotoRepresentationOfImage:depth:allowAlpha:containerFormat:colorSpace:options:error:] failed to add image to the PhotoCompressionSession. (kCMPhotoError_InvalidData) I also caught the error and printed it out in Xcode: Error Domain=CINonLocalizedDescriptionKey Code=3 "(null)" UserInfo={CINonLocalizedDescriptionKey=failed to write HEIC data to file., NSUnderlyingError=0x15b1295f0 {Error Domain=CINonLocalizedDescriptionKey Code=10 "(null)" UserInfo={CINonLocalizedDescriptionKey=failed to add image to the PhotoCompressionSession.}}} This code works on iOS 18. Also, as stated above, I'm able to write the JPG and PNG versions of this image. I was able to get a heif image created by using a CGImage and doing: CGImageDestinationCreateWithURL CGImageDestinationAddImage CGImageDestinationFinalize Hope this helps.
Sep ’25