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
0
votes
1 answer

Limitation of images numbers for PHPickerConfiguration?

Is it possible to set a limit for images numbers for PHPickerConfiguration? (Not selectionLimit!) I want my users can upload up to five images.
Roger W
  • 11
  • 2
0
votes
0 answers

Using PHPickerViewController results in a Permission Error

I am trying to use the PHPickerViewController to select images from my photo gallery and seeing the following error. Could not create a bookmark: NSError: Cocoa 257 "The file couldn’t be opened because you don’t have permission to view it I am…
Pradyot
  • 2,897
  • 7
  • 41
  • 58
0
votes
0 answers

swift 5, how do I load over 7000~ image in collectionView?

I am using UICollectionView for an album. I got the picture to load on iPhone 12. I got it to load about 100 pictures but if there are over 3000 pictures when I scroll the UICollectionView down it is very slow and sometimes the app stops. I am using…
Tanjima Kothiya
  • 5,695
  • 2
  • 8
  • 17
0
votes
0 answers

Is there a way to access photo category metadata in iOS?

In the Photos app or in the ImagePicker there is a search which helps select images of a certain type like “food”, “plate”, “breakfast”, etc. I wonder if I can somehow load all food photos into the app automatically when the user gives permission to…
pokidyshev
  • 53
  • 2
0
votes
1 answer

Return value from closure when closure is called synchronously (PHImageManager with isSynchronous = true)

The api I am calling is designed to be asynchronous but also has synchronous mode. I am using PHImageManager.requestImageDataAndOrientation (docs) to request image files, while writing code that is more readable (linear). let requestImageOptions =…
Ben Butterworth
  • 22,056
  • 10
  • 114
  • 167
0
votes
0 answers

PHPhotoLibrary.requestAuthorization(for:, handler:) does not calls handler block

I use new API for requesting of access for an assets library of a user: PHPhotoLibrary.requestAuthorization(for: .readWrite) { [weak self] (status:PHAuthorizationStatus) in print("called"); } iOS…
Andrew Romanov
  • 4,774
  • 3
  • 25
  • 40
0
votes
0 answers

BookmarkHow to use PHImageManager.DefaultManager.RequestAvAsset correctly? AvAsset is always null

asset is not null but avAsset always comes up as null. That's why I can't get video url. How can I fix this? var vOptions = new PHVideoRequestOptions(); vOptions.NetworkAccessAllowed = true; vOptions.Version =…
0
votes
0 answers

Memory usage issue with PHAssetResource.assetResources() call

I am testing the following codes // firstly list all the assets in the Photos. let fetchOptions = PHFetchOptions() fetchOptions.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: false)] fetchOptions.predicate = NSPredicate(format:…
0
votes
1 answer

Get list photo when setting new permission `Limit` in ios 14

I use code for get list image let options = PHFetchOptions() options.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: false)] options.predicate = NSPredicate(format: "mediaType == %d", PHAssetMediaType.image.rawValue) return…
0
votes
1 answer

Struct implementing PHPhotoLibraryChangeObserver

I have a struct for my model and it needs to conform to a protocol that is NSObject only. I am looking for a viable alternative to converting the model to a class. The requirements are: Keeping the model a value type Updating the model when…
Daniele Bernardini
  • 1,516
  • 1
  • 12
  • 29
0
votes
1 answer

Type metadata completion function for Crash | Crash when accessing a class that has some unavailable components

I have a crash when trying to use a class that contains iOS 14 only elements on iOS 12. The class looks like this (redacted some irrelevant stuff) public class AssetFuture { public enum AssetRepresentation { case asset(asset: PHAsset) …
Antzi
  • 12,831
  • 7
  • 48
  • 74
0
votes
0 answers

ERROR: IOSurfaceCreate 'RGBA' failed when calling requestImage from PHCachingImageManager

I am using PHCachingImageManager to get thumbnail images for all images in the iOS photo library which are then rendered using a SwiftUI List. It seems to work for a small number of images (e.g. the six that load with the simulator), but given 1000s…
okhobb
  • 758
  • 8
  • 22
0
votes
1 answer

How to obtain photo data/metadata after being picked in PHPickerViewController?

In the app I work on, I am being tasked with a requirement to present the user their device photos using a PHPickerViewController. Once selected, I need access to: The original image data The file name of the image The creation date of the…
Zach
  • 3,909
  • 6
  • 25
  • 50
0
votes
1 answer

How to download image from iCloud without re-saving it?

I ran into a problem when trying to pick photo from gallery (app crashes when I pick image uploaded on iCloud). So my first solution was to check if image is on device and if not, then download it from iCloud. I used this code let manager =…
Richard
  • 97
  • 8
0
votes
1 answer

When is PHFetchResultChangeDetails's "hasMoves" equal to YES?

I'm writing my subclasses of PHChange along with PHFetchResultChangeDetails. I understand fields like insertedIndexes, insertedObjects, fetchResultBeforeChanges, fetchResultAfterChanges etc. What I can't understand is a field hasMoves.…
olha
  • 2,132
  • 1
  • 18
  • 39