Questions tagged [photokit]

PhotoKit (also known as Photos Framework) is a framework that allows you to retrieve assets for display and playback, edit their image or video content, or work with collections of assets such as albums, moments, and iCloud Shared Albums. This framework is available in iOS 8.0 and later.

PhotoKit (also known as Photos Framework) is a framework that allows you to retrieve assets for display and playback, edit their image or video content, or work with collections of assets such as user albums, smart albums and iCloud Shared Albums. This framework is available in iOS 8.0 and later.

256 questions
8
votes
1 answer

Fetch only PHAssetCollections containing at least one photo

In iOS PhotoKit, I can fetch all non-empty albums like this: let fetchOptions = PHFetchOptions() fetchOptions.predicate = NSPredicate(format: "estimatedAssetCount > 0") let albumFetchResult = PHAssetCollection.fetchAssetCollections(with: .album,…
Phlippie Bosman
  • 5,378
  • 3
  • 26
  • 29
8
votes
1 answer

Modifing metadata from existing phAsset seems not working

In my App I want to make it possible, that the user sets an StarRating from 0 to 5 for any Image he has in his PhotoLibrary. My research shows, that there are a couple of ways to get this done: Save the exif metadata using the new…
Marcel T
  • 659
  • 1
  • 7
  • 28
8
votes
1 answer

PHChange changeDetailsForFetchResult - always returns nil

I am using the PHPhotoLibrary to retrieve several photo collections like this: _smartAlbumsFetchResult = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeSmartAlbum subtype:PHAssetCollectionSubtypeAlbumMyPhotoStream…
Sebastian Krogull
  • 1,468
  • 1
  • 15
  • 31
8
votes
0 answers

Can you get the photos in "Recently Deleted" using PhotoKit?

I've scanned the API and found nothing so far. I'd take a PHAssetCollection for "Recently Deleted", or a way to fetch the individual PHAssets. I'm not recommending (or disrecommending), but there are some solutions outside the API, and yet possibly…
Clay Bridges
  • 11,602
  • 10
  • 68
  • 118
7
votes
1 answer

Unable to edit screenshots, performChanges block fails

I'm developing an app that allows users to edit photos using PhotoKit. I was previously saving the edited photo to disk as a JPEG. I would like to avoid converting to JPEG and have implemented the modifications in order to do that. It works great…
Jordan H
  • 52,571
  • 37
  • 201
  • 351
7
votes
1 answer

Filter PHAssetCollections within radius of CLLocationCoordinate2d

I'm using the Photos framework (aka PhotoKit). In my app I need to gather Moments (which are of type PHAssetCollection). PHAssetCollection has a property of CLLocation *approximateLocation. However I cannot get the NSPredicate to work when I…
VaporwareWolf
  • 10,143
  • 10
  • 54
  • 80
7
votes
0 answers

PHAsset fetchAssetsWithLocalIdentifiers returning assetFetchResults in localIdentifier order

I cannot find this issue addressed in Apple documentation, Apple Forums, or stackOverflow. I have attempted to create code and look at results from various options. It appears that if a sort descriptor is not provided the call to [PHAsset…
McInvale
  • 158
  • 1
  • 10
7
votes
2 answers

Given a CIImage, what is the fastest way to write image data to disk?

I'm working with PhotoKit and have implemented filters users can apply to photos in their Photo Library. I am currently obtaining the image, applying a filter, returning the edited version as a CIImage, then I convert the CIImage into NSData using…
Jordan H
  • 52,571
  • 37
  • 201
  • 351
7
votes
4 answers

How to access NSData/NSURL of slow motion videos using PhotoKit

Working with new Photo framework, I can access the NSData of PHAssets using requestImageDataForAsset. I can also access the file URL using the PHImageFileURLKey of the returned info NSDictionary. [[PHImageManager defaultManager]…
GuillermoMP
  • 1,694
  • 16
  • 19
6
votes
0 answers

How to display current selected photos when presenting a PHPickerViewController manually?

Is there a way to show the user's current photo selections when presenting a PHPickerViewController manually? For example, when using the following code the picker doesn't show any of the user's currently selected photos. var pickerConfig =…
JKo
  • 1,260
  • 1
  • 10
  • 18
6
votes
0 answers

PHImageManager requestImageForAsset Crashes on iOS13 for photo assets that aren't yet loaded locally

Exception/crash upon calling PHImageManager requestImageForAsset:targetSize:contentMode:options:resultHandler: "uncaught exception 'NSInvalidArgumentException', reason: 'executeFetchRequest:error: A fetch request must have an entity." Happens 100%…
6
votes
9 answers

PHImageResultIsDegradedKey/PHImageFileURLKey is not found

iOS 13 beta4 no longer gives 1) PHImageFileURLKey 2) PHImageResultIsDegradedKey in image result info keys. Anyone knows a way to find the fileurl of the PHAsset?
guhan0
  • 666
  • 6
  • 19
6
votes
6 answers

Save video to the gallery and get the path for the video stored to Gallery

I want to save a video chosen from UIImagePickerController to the Photos album. After that i need to fetch the URL to the saved path. I saw some pre-existing questions which answer with use of ALAssetsLibrary which is now deprecated. Like : Save…
Ankit Kumar Gupta
  • 3,994
  • 4
  • 31
  • 54
6
votes
2 answers

PHObject localIdentifier reliability

Are there ever circumstances where the localIdentifier could change or not be accurate? I'm working on an application that backs up photos and have been told by my colleagues that the localIdentifier can't be trusted. However, after doing some…
Richmond Watkins
  • 1,342
  • 9
  • 17
6
votes
3 answers

estimatedAssetCount returns a wrong count

I need to display the camera roll album with the count of images in it. I'm using the below code to get the camera roll album. let smartCollections = PHAssetCollection.fetchAssetCollectionsWithType(.SmartAlbum, subtype: .SmartAlbumUserLibrary,…
Isuru
  • 30,617
  • 60
  • 187
  • 303
1 2
3
17 18