Saving image failed with AVDepthData

Hi, I'm Patrick. I received some users to report an issue which can't save the image in iOS13 beta. I debugged my codes and can't find any resolution. My app is made for taking portrait pictures with depth data by using the dual camera iPhone. I also tested the official sample app - AVCamPhotoFilter which you can get from the "https://developer.apple.com/documentation/". If I add the AVDepthData while using the interface of CGImageDestinationCreateWithData, the CGImageDestinationFinalize can't get the correct returned value, but the warning happens in the console with " (JFIF container format does not support rotation; place rotation into Exif payload) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/EmbeddedCoreMedia/EmbeddedCoreMedia-2501.6.1.1/Sources/Photo/FigPhotoCompressionSession+JFIF.c:695". I also test the compression for JPEG and HEIC and get the same result, and they can't be converted if I attached the AVDepthData. It's the official demo and I only added 3 lines code for testing.


Here is the code,


private class func jpegData(withPixelBuffer pixelBuffer: CVPixelBuffer, attachments: CFDictionary?, depthData : AVDethData?) -> Data? {

if depthData != nil {
            var auxDataType: NSString?
            let auxData = depthData?.dictionaryRepresentation(forAuxiliaryDataType:&auxDataType)
            CGImageDestinationAddAuxiliaryDataInfo(cgImageDestination, auxDataType!, auxData! as CFDictionary)
        }

Please fix it within next update. Thank you.