when I get results from picker: PHPickerViewController, didFinishPicking results: [PHPickerResult])
and I load the image using itemProvider .loadFileRepresentation
(the itemProvider is the NSItemProvider provided by the PHPickerResult)
will the url that's returned by this method be guaranteed to have the file extension ie, "file://image.jpeg" not "file://image"
I want to know if i need to just check the extension to know its file type. (FYI in case this makes a difference, im only interested in user screenshots and screenrecordings)
Whether you can rely on the format of the returned url is not clear in the documentation. However, you can call hasItemConformingToTypeIdentifier(_:) method on the NSItemProvider to find out if the NSItemProvider is able to provide the formats you're interested in receiving.
Though, I should mention, I'm not sure there's a specifically documented file type for screenshots. That may be subject to change without notice (I'll update this thread if I find documentation about that).
Worth noting, screenshots created in macOS Sequoia 15.3.2 (24D81) and in iOS 18.3.2 have the User Comment in the EXIF data set to the string "Screenshot" (I'll update this thread if I find documentation about that).
If you're like to have an officially documented way of determining if an image file was created from a screenshot or a video is a screen recording won't you please consider filing an enhancement request asking for that functionality. You can file an enhancement request using Feedback Assistant. Once you file the request, please post the Feedback number here.
If you're not familiar with how to file enhancement requests, take a look at Bug Reporting: How and Why?