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

442 questions
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
  • 599
  • 1
  • 4
  • 28
8
votes
1 answer

Sharing Video PHAsset via UIActivityController

I am trying to share video PHAsset via UIActivityController using requestAVAsset. This works with Messaging, but not with AirDrop, indicating as 'Failed'. PHCachingImageManager.default().requestAVAsset(forVideo: asset, options: nil, resultHandler: …
Gizmodo
  • 2,563
  • 4
  • 32
  • 71
8
votes
2 answers

Getting size (height and width) from PHAsset

Is there a way to get the height and width of the image from a PHAsset object. I'm trying to make an image picker with a custom UICollectionViewLayout (Kind of like the main page of Pinterest app) I'v fetched all of the photos from the photo library…
8
votes
0 answers

PHAsset identifier persisting across devices

Following on from my previous question, and according to (among others) this question, the localIdentifier of a PHAsset doesn't persist across devices (after the photo syncs over iCloud). How can I store a reference to a PHAsset (image) that will…
Cai
  • 381
  • 3
  • 14
8
votes
3 answers

Phasset + AfNetworking Upload Multiple Videos

Currently I'm using the following code to upload videos: NSURLRequest *urlRequest = [[AFHTTPRequestSerializer serializer] multipartFormRequestWithMethod:@"POST" URLString:[[entity uploadUrl]absoluteString] parameters:entity.params…
ProblemSlover
  • 2,409
  • 2
  • 20
  • 32
8
votes
4 answers

How to fetch all images from custom Photo Album - Swift

How to fetch all images from custom Photo Album? var fetchOptions = PHFetchOptions() fetchOptions.sortDescriptors = [NSSortDescriptor(key:"creationDate", ascending: false)] fetchOptions.predicate = NSPredicate(format: "mediaType = %d",…
fatihyildizhan
  • 7,103
  • 5
  • 54
  • 74
7
votes
3 answers

Getting the URL of picture taken by camera with Photos Framework

I have an app that uses a UIImagePickerController to retrieve pictures both from camera and from the photos library. In the image picker delegate I only want to save the NSURL (UIImagePickerControllerReferenceURL) of the picked image to save…
7
votes
3 answers

Extract video portion from Live Photo

Has anyone figured out how to extract the video portion from a Live Photo? I'm working on an app to convert Live Photos into a GIF, and the first step is to get the video file from the Live Photo. It seems like it should be possible, because if you…
JYeh
  • 4,113
  • 2
  • 24
  • 40
7
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,361
  • 1
  • 13
  • 30
7
votes
1 answer

PHAssetCollectionChangeRequest: addAssets() now accepts NSFastEnumeration. how to achieve this?

My Application tries to import an image from photos and adds to an album. But in latest swift changes. addAssets() accepts parameter as NSFastEnumeration. So I get an error as shown in the image. even the Apple API document has this same code:…
Imran
  • 689
  • 1
  • 9
  • 21
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,324
  • 14
  • 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
  • 626
  • 6
  • 18
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
  • 38,492
  • 24
  • 114
  • 205
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,218
  • 10
  • 30
1 2
3
29 30