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
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
  • 12,511
  • 18
  • 88
  • 165
13
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
  • 1,933
  • 4
  • 24
  • 52
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
  • 10,085
  • 7
  • 48
  • 67
13
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
  • 45,794
  • 29
  • 162
  • 306
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
  • 12,511
  • 18
  • 88
  • 165
11
votes
3 answers

Get file size of PHAsset without loading in the resource?

Is there a way to get the file size on disk of a PHAsset without doing requestImageDataForAsset or converting it to ALAsset? I am loading in previews of a user's photo library - potentially many thousands of them - and it's imperative to my app that…
Ryan Daulton
  • 849
  • 10
  • 21
11
votes
3 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,012
  • 3
  • 11
  • 24
11
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,331
  • 1
  • 16
  • 33
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
  • 2
  • 15
10
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,034
  • 9
  • 36
  • 76
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
  • 385
  • 2
  • 20
9
votes
3 answers

PHImageManager's method "requestImageDataForAsset" gives crash in Swift

I am using PHImageManagers's requestImageDataForAsset to calculate memory size of particular photos in camera roll. It is working fine in my device but some users getting countinous crash after calculate memory size (found by analytics and crash…
Mohanadevi
  • 257
  • 4
  • 19
9
votes
2 answers

PHAsset returned from fetchAssetsWithALAssetURLs: is always nil when choosing a photo from the "My Photo Stream" album using UIImagePickerController

I am using a UIImagePickerController to let the user choose a photo or video to share in the app. When the user chooses a media item in their Library, I execute this code in one of the UIImagePickerController's delegate methods: -…
8
votes
2 answers

iOS 14 Beta check PHAsset permissions for .limited access level

in iOS 14 beta, is there a way to check if the app has permissions to load a PHAsset image before trying to load it with PHImageManager.requestImage? This is for PHAuthorizationStatus.limited - when I fetch all assets in a PHAssetCollection, it…
kzamanov
  • 81
  • 6
1
2
3
29 30