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

How to get URL for a PHAsset?

I am using a third party library to select multiple images from the Photo Library. On selecting multiple images it returns an array of PHAsset objects. Now, I want to save the URL (or some reference) for these objects in the core data. But I do not…
Utsav Dusad
  • 2,139
  • 4
  • 31
  • 52
15
votes
6 answers

How to properly detect a PHAsset's file type (GIF)

I have no idea why this is so difficult. I'm trying to determine the file type of a PHAsset, specifically, I want to know if a given asset represents a GIF image or not. Simply inspecting the asset's filename tells me it's an MP4: [asset…
mitchtreece
  • 181
  • 1
  • 2
  • 7
14
votes
1 answer

How to format NSPredicate for PHFetchOptions in Swift?

I cannot figure out the proper format necessary to define a predicate for an instance of PHFetchOptions. I've tried so many combinations but they either do not compile or no assets are returned. The goal is to get only the photos (no videos) in a…
Jordan H
  • 52,571
  • 37
  • 201
  • 351
14
votes
2 answers

Connection to assetsd was interrupted or assetsd died

I load photos from PHAssets. I get this error log when I load some images and pass them to another view controller. I can't seem to find anything online about this. Anyone encounter this and know what it is? I also get this error along with…
Aggressor
  • 13,323
  • 24
  • 103
  • 182
13
votes
4 answers

Save image to photo library using photo framework

My app crashes every time when I try to save image using photo framework. -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{ _mChangeRequest = [PHAssetChangeRequest…
Shaik Riyaz
  • 11,204
  • 7
  • 53
  • 70
12
votes
3 answers

High memory usage looping through PHAssets and calling requestImageForAsset

I'm using an image picker library to allow the user to select many images from their photo library. They are returned as an array of PHAssets. Then, I want to convert all the PHAssets to UIImages and write them to the app's storage. At the moment,…
Charles
  • 4,372
  • 9
  • 41
  • 80
12
votes
4 answers

UIImage size returned from 'requestImageForAsset' is not even close to the 'targetSize' setting

I've thoroughly read through the latest iOS8 photo frame work and I am trying to fetch some assets from the users library to display. I let the user edit 4 images at once. But because of this, I need to compress the images otherwise the app will…
Aggressor
  • 13,323
  • 24
  • 103
  • 182
12
votes
3 answers

How do I determine if a PHAsset in a PHFetchResult represents a deleted photo?

I'm trying to grab a thumbnail of the last photo taken on a device using the new Photos framework in iOS 8. The code I have right now to do this is the following: PHFetchOptions *fetchOptions = [PHFetchOptions new]; fetchOptions.sortDescriptors =…
Ziewvater
  • 1,413
  • 1
  • 18
  • 33
11
votes
1 answer

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
  • 441
  • 4
  • 15
11
votes
4 answers

iOS : How to convert a video PHAsset to NSData

I want to put the videos stored on my iPhone to my Google Drive. I have already done with images, but with videos, it's an other problem... For images, no problem, I convert my asset to an NSData with this method : data =…
testa abalez
  • 1,042
  • 3
  • 13
  • 28
10
votes
1 answer

Get a PHAsset from ReferenceURL: fetchAssets(withALAssetURLs:options:) DEPRECATED

My goal is to upload original resolution device captured video files to S3 using AWSS3TransferUtility. User selects a video using UIImagePickerController however, if I pass info[UIImagePickerControllerMEDIAURL] to the transferUtility it always…
T Rogers
  • 101
  • 6
10
votes
3 answers

Swift fetch images and videos from camera roll

I am using "PHAsset" for fetching camera roll assets. I am using PHAsset.fetchAssetsWithMediaType(.Image, options: options) for fetching all gallery images. But I want to fetch all Images and Videos at a same time and show in a collection view…
Rupshikha
  • 213
  • 1
  • 3
  • 16
9
votes
3 answers

IOS Photos framework

I want to retrieve all the photos from all the local albums on the device. Basically all the photos that are on the device Will the list of local identifiers be unique ? What is the best approach for this using the photos framework. My question is…
Noam Segev
  • 395
  • 3
  • 20
9
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,538
  • 2
  • 23
  • 33
9
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,273
  • 3
  • 27
  • 40
1
2
3
30 31