strawnut
strawnut

Reputation: 375

How to check same file using NSItemProvider in iOS?

When I get some images of Photos in iPhone device using NSItemProvider by PHPickerViewController, I want to know how to check same file(image) with picked photos.

Because I use NSItemProvider, the image is copied item. It isn't original file. So, Can't compare two images directly.

Upvotes: -2

Views: 30

Answers (1)

matt
matt

Reputation: 535890

I don't see why you "can't compare two images": just look to see if their derived pngData is the same.

If that's insufficient, and you really want to know whether the user has chosen the same photo from the library on two different occasions, you would need to get library read permission from the user, configure the picker appropriately, and get the PHAsset underlying each returned item; a PHAsset has a unique identifier, and so you would be able to compare unique identifiers.

Upvotes: 0

Related Questions