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
3
votes
2 answers

PHFetchOptions() Photos Only Using PHAsset & PHAssetCollection

I am using a chunk from Apple's sample code here: override func awakeFromNib() { // Create a PHFetchResult object for each section in the table view. let allPhotosOptions = PHFetchOptions() allPhotosOptions.sortDescriptors =…
Gizmodo
  • 3,151
  • 7
  • 45
  • 92
3
votes
1 answer

Swift PHAsset from NSURL

I am working on PHAsset and NSURL on Swift. I have an image url, for example file:///var/mobile/Media/DCIM/100APPLE/IMG_0043.JPG. How can i make a PHAsset from this NSURL in Swift?
Sazzad Hissain Khan
  • 37,929
  • 33
  • 189
  • 256
3
votes
1 answer

How to compare PHAsset to UIImage

I have converted some PHAsset to UIImage : PHImageManager *manager = [PHImageManager defaultManager]; [manager requestImageForAsset:asset targetSize:PHImageManagerMaximumSize …
iOSGeek
  • 5,115
  • 9
  • 46
  • 74
3
votes
0 answers

NSItemProvider to PHAsset

I'm building an app and I need to get the PHAsset of an image from the NSItemProvider. The NSURL I'm getting is for example:…
Andres
  • 11,439
  • 12
  • 48
  • 87
3
votes
2 answers

[PHCollectionList canContainCustomKeyAssets]: unrecognized selector sent to instance

Fetching PHAssets is now crashing for me on latest versions of iOS (iOS 9.2 and iOS 9.3). It previously worked fine. The error I am getting is: [PHCollectionList canContainCustomKeyAssets]: unrecognized selector sent to instance Terminating app…
William GP
  • 1,252
  • 1
  • 14
  • 29
3
votes
0 answers

how to get all videos in photos library using PHAsset

how to get all videos in photos library using PHAsset. NSArray* selectedMediaTypes = @[@(PHAssetMediaTypeImage)]; options.predicate = [NSPredicate predicateWithFormat:@"mediaType in %@", selectedMediaTypes]; options.sortDescriptors =…
Moaz Saeed
  • 1,006
  • 3
  • 10
  • 23
3
votes
2 answers

How to save multiple videos into application document directory?

I am using GMImagePicker to fetch assets of camera roll. After selecting single or multiple videos i got PHAsset in arrayArray. assetArray data in this formate " 40D4733D-4C7B-443D-8093-C28E39ACA45E/L0/001 mediaType=2/0,…
Mitesh Dobareeya
  • 970
  • 1
  • 11
  • 36
3
votes
1 answer

assetResourcesForAsset: cause deadlock

Two thread access fileName at the same time. Set If 0 made deadlock. but If 1 was all going well. So what brought this on?
3
votes
2 answers

PHAsset, how to retrieve the specific PHAsset object after app restarts (ios8 Photos)

I used to use ALAssetLibrary. And it has assetForURL function, so that I can save the URL in to NSUserDefaults and to retrieve ALasset by URL after app restarts. However, when I change to PHAsset, I can't find this kind of function. What I found is…
Bruce Tsai
  • 1,440
  • 2
  • 12
  • 18
3
votes
1 answer

What is the difference between ALAsset and PHAsset?

I've been curious this morning about PHAsset. I used to deal with ALAsset last month. I downloaded an iOS project from Apple website that uses ALAsset to make a simple iOS Photos-like app, and I modified it to add more features to be more iOS…
Glenn Posadas
  • 12,555
  • 6
  • 54
  • 95
3
votes
1 answer

Is it possible to delete a Photo from the iPhone without alert view?

I use this method : PHPhotoLibrary.sharedPhotoLibrary().performChangesAndWait({ PHAssetChangeRequest.deleteAssets(assets) self.dismissViewControllerAnimated(true, completion: nil) }) The…
testa abalez
  • 1,042
  • 3
  • 13
  • 28
3
votes
0 answers

iOS - Photos are not loaded and displayed for the first time after giving permission

I am using iOS 8 Photos framework to load photo and display them on a custom view. When asked for permission to access photo library, after I clicked "OK", the photo is not loaded until I go back and load this view again. After that everything goes…
Wizard
  • 389
  • 1
  • 2
  • 12
3
votes
2 answers

PHAssetChangeRequest always returns nil when creating video assets

I am saving a newly-created video file in the local Documents. I would then like to copy it into the Photo Library using the Photos framework. Problem is, even though the video is being written out (and I can confirm it's there and viewable), the…
Eric Brochu
  • 188
  • 1
  • 8
3
votes
3 answers

Deleting PHAssetCollection (Swift)

I created an PHAssetCollection to house my photos for my app, and it works fine. However, I am trying to have it so the user can delete the PHAssetCollection when they press a button. How do I go about deleting the entire AssetCollection ("App…
Josh O'Connor
  • 4,694
  • 7
  • 54
  • 98
3
votes
1 answer

Synchronizing Async Stuff in Swift

I'm not sure why Apple designs so many things in blocks... At least the problem in "PHAsset to UIImage" was able to be resolved due to a provided option. However, some of the other things I need are not provided by options. For example: func…
dcheng
  • 1,827
  • 1
  • 11
  • 20