How to fetch all available EXIF metadata from a jpeg image?

I am trying to fetch kCGImagePropertyExifUserComment from an image (I will discuss how usercomment is saved, towards the end of this question). I am fetching the data through PHImageManager.requestImageData and then feeding this data to below methods.

let imageSource = CGImageSourceCreateWithData(data as CFData, nil)

let dictionary = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, nil)

The resulting dictionary doesn't contain usercomment and don't even show the {EXIF} key. This is happening only for few internet downloaded images that doesn't show proper metadata. For camera taken images this is working fine.

But there are ios apps and websites that can read the usercomment I'm storing.

Saving a string in usercomment - I'm using CGImageDestinationAddImageFromSource and CGImageDestinationFinalize methods for including the usercomment in image metadata. This data is saved to a temporary file location and following method is used to save data to PhotoLibrary. PHAssetChangeRequest.creationRequestForAssetFromImage(atFileURL: url)

Please note that the code is working for most of the images. But only for few jpeg files I noted the issue. I want to fetch usercomment in all cases. Please guide me.

How to fetch all available EXIF metadata from a jpeg image?
 
 
Q