Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get only images in the camera roll using Photos Framework

Tags:

The following code loads images that are also located on iCloud or the streams images. How can we limit the search to only images in the camera roll?

var assets = PHAsset.fetchAssetsWithMediaType(PHAssetMediaType.Image, options: nil) 
like image 305
William Falcon Avatar asked Sep 08 '14 18:09

William Falcon


People also ask

What are camera roll photos?

The Camera Roll is a unique view that only you can see. It automatically finds and shows you every photo and video (private and public) you've ever uploaded to your account. Access the Camera Roll. Mouse over You, then click Camera Roll. Sort your photos and videos.


1 Answers

After adding the Camera Roll and Photo Stream albums, Apple added the following PHAssetCollectionSubtype types in iOS 8.1:

  1. PHAssetCollectionSubtypeAlbumMyPhotoStream (together with PHAssetCollectionTypeAlbum) - fetches the Photo Stream album.

  2. PHAssetCollectionSubtypeSmartAlbumUserLibrary (together with PHAssetCollectionTypeSmartAlbum) - fetches the Camera Roll album.

Haven't tested if this is backward-compatible with iOS 8.0.x though.

like image 59
StatusReport Avatar answered Oct 04 '22 05:10

StatusReport