Questions tagged [phasset]

A `PHAsset` is an object in the iOS Photos Framework (aka PhotoKit) that represents an image or video file on the iOS device.

A PHAsset object represents an image or video file that appears in the Apple Photos app, including iCloud Photos content.

To display or edit assets, use the PHAsset class to fetch asset objects for the photos or videos you want to work with. An asset object is immutable and contains only the metadata for the photo or video it represents.

For more detailed info: https://developer.apple.com/documentation/photokit/phasset

451 questions
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
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
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
0 answers

Is there a way to speed up fetching PHAsset data like filesize?

We are developing a storage app that, among other things, syncs and backs up photos on the user's device with the cloud. We use the file size and image name together to form a makeshift hash for comparison. The problem we are facing is when users…
6
votes
1 answer

How do I test PHImageResultIsInCloudKey?

My app has a custom photo picker that uses the Photos framework to browse albums and select a photo. I have isolated reports of a very specific bug that occurs only if the user (a) has iCloud Photo Library turned on, (b) has Optimize Storage turned…
Bill
  • 44,502
  • 24
  • 122
  • 213
6
votes
2 answers

PHCachingImageManager.requestImage is always called twice?

I have a UICollectionView with a custom UICollectionViewCell that should get and display thumbnail (low quality) photos from the Photo (usually the user can select more than 1 photo) in each UIImageView in the cell. I've been playing with the…
Dani
  • 3,427
  • 3
  • 28
  • 54
6
votes
2 answers

Create folder in custom photo album

I have a custom album in which my app saves picture from camera. I am wondering if there is a way I can create folders inside my album so I can stack certain images inside it? ANSWER As fellow members mentioned, sadly there is no way you can create…
ZassX
  • 1,369
  • 2
  • 14
  • 35
6
votes
2 answers

Can get image from PHAsset of library

I am using QBImagePickerController for selecting multiple images at a time. So, here is my whole code I am presenting imagepickerController with this code let imagePickerController = QBImagePickerController() imagePickerController.delegate =…
Jitendra Modi
  • 2,344
  • 12
  • 34
6
votes
1 answer

While converting PHAsset to UIImage losing transparency

After I pick an image from Image picker and try to convert PHAsset to UIImage image is losing transparency of the png Image. I tried searching everywhere but didn't find anything about it. func getAssetThumbnail(asset: PHAsset) -> UIImage { …
O-mkar
  • 5,430
  • 8
  • 37
  • 61
6
votes
2 answers

How to use PHAssetResourceRequestOptions progressHandler/PHAssetResourceProgressHandler

I'm trying to retrieve/download the video/frames of Live Photo. As for the API documents there is a possible scenario which the Live Photos will be store at iCloud. In order to retrieve them as well you need to declare let options =…
Roi Mulia
  • 5,626
  • 11
  • 54
  • 105
6
votes
4 answers

How to generate thumbnails of images on iCloud Drive?

This appears easy, but the lack of documentation makes this question impossible to guess. I have pictures and videos on my app's icloud drive and I want to create thumbnails of these assets. I am talking about assets on iCloud Drive, not the iCloud…
Duck
  • 34,902
  • 47
  • 248
  • 470
6
votes
1 answer

How to use PHCachingImageManager

I know that there is already this question on SO, but I don't think that the given answer is satisfying/complete: How can IOS Photos app can show hundreds of photos in one screen? What I want to achieve I want something like the image selection in…
Alexander Scholz
  • 2,100
  • 1
  • 20
  • 35
6
votes
4 answers

Getting the location of a PHAsset in Swift

For some reason the location property on a PHAsset is only exposed in Objective-c and not in Swift. Documentation: PHAsset.location To work around it, I figured I could create a Objective-C class whose sole purpose is to extract the location and…
Linus Unnebäck
  • 23,234
  • 15
  • 74
  • 89
5
votes
1 answer

How to retrieve PHAsset from PHPicker?

In WWDC20 apple introduced PHPicker - the modern replacement for UIImagePickerController. I'm wondering if it's possible to retrieve PHAsset using the new photo picker? Here is my code: private func presentPicker(filter: PHPickerFilter) { var…
Hamid Yusifli
  • 9,688
  • 2
  • 24
  • 48
5
votes
1 answer

Swift: PHAssetChangeRequest fails for HEIC image

I want to perform an edit, a JEPG compression for example, on an image from the gallery (taken by iPhone camera) but it fails when the input image is an HEIC image but works with JPEG images. I retrieve the image within a PHAsset object via…
Maysam
  • 7,246
  • 13
  • 68
  • 106