Is CKAsset image metdata preserved?

37 Views Asked by At

Just making sure I'm not missing something before I go implementing another way to store metadata for the images I upload as CKAssets. Right now I've added an extension to CKAsset like so:


extension CKAsset {
    func getMetadata() -> [AnyHashable:Any]? {
        if let url = fileURL {
            let data = try? Data(contentsOf: url)
            let source = CGImageSourceCreateWithData(data as! CFMutableData, nil)
            let metadata = CGImageSourceCopyPropertiesAtIndex(source!, 0, nil) as? [CFString : Any]
            return metadata
        }
        return nil
    }
}

But it seems to have wiped all the metadata apart from some very simple properties like width and height.

Am I missing something or is the metadata not saved with a CKAsset?

0

There are 0 best solutions below