0

Hi i have used following api to fetch camera roll images. but i need to filter images clicked by camera device but not downloaded from internet.

smartAlbums = PHAssetCollection.fetchAssetCollections(with: .album, subtype: .smartAlbumUserLibrary, options: allPhotosOptions)
technoAndroid
  • 31
  • 2
  • 7
  • 2
    Possible duplicate of [How to get only images in the camera roll using Photos Framework](https://stackoverflow.com/questions/25730830/how-to-get-only-images-in-the-camera-roll-using-photos-framework) – Ben Ong Jul 24 '17 at 08:56
  • camera roll give images clicked from camera and downloaded images but not specifically from camera – technoAndroid Jul 24 '17 at 09:12
  • You can do this with extracting the EXIF data from the images. – Tamás Sengel Jul 24 '17 at 09:34
  • in exif data which attribute i need to check – technoAndroid Jul 24 '17 at 10:07
  • I found properties `sourceType`, `mediaType` and `mediaSubtypes` in PHAsset which I believe can be used to filter the result you want but I lack time today to test and create and answer. You may want to look into it, I'll also try and provide a more solid solution another day – Ben Ong Jul 24 '17 at 10:31
  • i have tried these but didn't find a solution.if u find any pls provide it – technoAndroid Jul 24 '17 at 14:02
  • I could not provide a complete answer, but PHAsset's `mediaSubtypes` is 0 for downloaded images but holds a value that describes the image for taken photos. However I did not test it extensively so you might want to also test if an image taken by another iPhone/iPad and sent directly to your device will also return values equal to locally taken photos. I am certain that it can be used to filter out any normal downloaded images as photos taken by the device camera will definitely have at least one item of the option set. – Ben Ong Jul 25 '17 at 01:23

0 Answers0