Hi, Experts I am using phpickerviewcontroller to open photos in iPhone. It works well for most of photos, such as jpeg, heif. But it failed for photo with raw image on iPhone14 plus. And I found the TypeIdentifier for it is com.adobe.raw-image. I use result.itemProvider.loadFileRepresentation(forTypeIdentifier: "com.adobe.raw-image") to load the raw photo, it always failed, with "Error loading file representation: Cannot load representation of type com.adobe.raw-image". I had try some other param: such as forTypeIdentifier: public.image, public.camera-raw-image, both of them did not work.
How can I load this type of raw photo?
Below is my code details:
// MARK: - PHPickerViewControllerDelegate
func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) {
picker.dismiss(animated: true, completion: nil)
var resultIndex = 0
DDLogInfo("Pick \(results.count) photos")
for result in results {
resultIndex += 1
DDLogInfo("Process \(resultIndex) photo")
DDLogInfo("Registered type identifiers for itemProvider:")
for typeIdentifier in result.itemProvider.registeredTypeIdentifiers {
DDLogInfo("TypeIdentifier \(typeIdentifier)")
}
if(result.itemProvider.hasItemConformingToTypeIdentifier(UTType.image.identifier)) {
DDLogInfo("Result \(resultIndex) is image")
}
if result.itemProvider.canLoadObject(ofClass: UIImage.self) {
DDLogInfo("Can load \(resultIndex) image")
//more code for photo
} else {
DDLogInfo("Load special image, such as raw")
result.itemProvider.loadFileRepresentation(forTypeIdentifier: "com.adobe.raw-image") { url, error in
if let error = error {
DDLogInfo("Error loading file representation: \(error.localizedDescription)")
return
}