WebMar 3, 2024 · [0] = Foundation.NSSortDescriptor (key: "creationDate", ascending: true) let fetchResult = PHAsset.fetchAssets (with: PHAssetMediaType.image, options: fetchOptions) guard let lastAsset = fetchResult.lastObject else { return } PHPhotoLibrary.shared ().performChanges { PHAssetChangeRequest.deleteAssets ( [lastAsset] as … WebJul 9, 2016 · public enum PHAssetMediaType : Int { case Unknown case Image case Video case Audio } Because it's not an OptionSetType you can't use it like a bitfield and …
How to get only images in the camera roll using Photos …
WebJan 21, 2015 · //fetch all assets, then sub fetch only the range we need var assets = PHAsset.fetchAssetsWithMediaType(PHAssetMediaType.Image, options: fetchOptions) … WebIf you want to be sure of number of assets you have to perform fetch and get the count like: let assetsFetchResult = PHAsset.fetchAssetsInAssetCollection (assetCollection, options: nil) let numberOfAssets = assetsFetchResult.count let estimatedCount = (assetCollection.estimatedAssetCount == NSNotFound) ? -1 : … he is ever interceding bible verse
Formatting NSPredicate for Photokit Fetch - Stack Overflow
WebOct 22, 2024 · Don't fetch all assets and filter by mediaSubtype, as it is unnecessary. Try the method: + (PHFetchResult *)fetchAssetsWithMediaType: (PHAssetMediaType)mediaType options: (PHFetchOptions *)options; like so: PHFetchResult *result = [PHAsset fetchAssetsWithMediaType:PHAssetMediaTypeImage options:nil]; This will return all … WebMay 3, 2016 · self.assetsFetchResults = [PHAsset fetchAssetsWithMediaType:PHAssetMediaTypeImage options:nil]; Above line solved the issue for me. Share. Improve this answer. Follow answered May 11, 2015 at 11:37. bhoomi bhoomi. 373 1 1 gold badge 4 4 silver badges 11 11 bronze badges. WebMar 6, 2015 · Read the bottom! The resultHandler for PHImageManager.requestImage returns 2 objects: result and info.. You can get the original filename for the PHAsset (like IMG_1043.JPG) as well as its full path on the filesystem with:. let url = info?["PHImageFileURLKey"] as! URL This should work right, but for some reason it … he is european