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

PHAsset with Optimize IPhone Storage

When I use the device Optimize IPhone Storage (Settings -> iCloud -> Photos) some photos will be sent to iCloud. How do I know that PHAsset is in iCloud before retrieve the image?
Mikhail S
  • 3,338
  • 3
  • 21
  • 34
4
votes
1 answer

How can I edit or rename a PHAssetCollection LocalizedTitle?

I want to change the albumName in my app. if ([collection canPerformEditOperation:PHCollectionEditOperationRename] == YES) { //rename localizedTitle } If that is "YES", I want to change the name. My code is: PHFetchOptions…
GioHong
  • 51
  • 4
4
votes
1 answer

Using PHImageManager, is it possible to request a group of UIImages from a group of PHAssets in one call?

If not, what would be the best way to accomplish this? Say a user selects several PHAssets in the UI, then taps "Done". I want to organize those images into an array of their corresponding UIImages to cache into the app. Do I have to call…
Doug Smith
  • 29,668
  • 57
  • 204
  • 388
4
votes
1 answer

fetching photos by date - iOS

Disclaimer –I’m new to iOS and to this forum too. I have a need to get pictures taken in specific dates (let’s say January 9-January 12) . I don't want to go over all the photos in the photo library for enhance the app performance. I am looking…
Amit Fisher
  • 111
  • 5
4
votes
5 answers

Applying metadata to image causes performChanges request to fail

I am using PhotoKit to edit photos and I need to preserve the metadata from the original photo. To do so I save the metadata then provide it to the options parameter in CGImageDestinationAddImage. I am able to finalize it and write it to disk…
Jordan H
  • 52,571
  • 37
  • 201
  • 351
4
votes
2 answers

iOS 8 Load Images Fast From PHAsset

I have an app that lets people combine up to 4 pictures. However when I let them choose from their photos (up to 4) it can be very slow even when I set image quality to FastFormat. It will take 4 seconds (about 1 second per photo). On highest…
Aggressor
  • 13,323
  • 24
  • 103
  • 182
3
votes
1 answer

PHAsset video EXIF metadata retrieval

Currently, I am extracting EXIF metadata for PHAsset's that are images, but not having luck with videos. For images, this works for me: let imageOptions = PHImageRequestOptions() imageOptions.isNetworkAccessAllowed = true imageOptions.isSynchronous…
Gizmodo
  • 3,151
  • 7
  • 45
  • 92
3
votes
4 answers

ios13 get original image using PHImageManager

on ios 13 PHImageManagerMaximumSize does not work. when calling let manager = PHImageManager.default() let option = PHImageRequestOptions() option.isSynchronous = synchronous option.isNetworkAccessAllowed = true option.resizeMode =…
Nemo
  • 587
  • 6
  • 12
3
votes
1 answer

Getting the url of a video (PHAsset) for video uploading - swift

I've created two different functions for uploading PHASSets to my backend - the uploadImageAsset() uploads all of the assets that are images: func uploadImageAsset(asset: PHAsset, projectRef: String) { let userID = Auth.auth().currentUser?.uid …
Vandal
  • 708
  • 1
  • 8
  • 21
3
votes
1 answer

Getting the URL Path of an Image from device in iOS Swift

I am trying to get the image path using the PHImageManager on an actual device and not simulator. I am using photoUrl = info!["PHImageFileURLKey"] as? URL to get the url. Now when I run my code on simulator , I get 9 key/value pairs in my info .…
Nikhil Viradiya
  • 87
  • 2
  • 15
3
votes
0 answers

How to open image in Instagram's sharing flow?

I'm trying to open an image in Instagram's sharing flow without having to download the image into the Photo Library. These two approaches work but they have downsides: First Approach: This approach saves the image in a temporary location. It then…
Jay
  • 43
  • 4
3
votes
1 answer

How to get an authorized PHAsset from UIImagePickerController?

I have this code: @IBAction func importButtonPressed(_ sender: Any) { self.imagePicker.sourceType = .photoLibrary self.imagePicker.allowsEditing = true self.imagePicker.mediaTypes = [kUTTypeMovie as String, kUTTypeImage as…
BigBoy1337
  • 4,735
  • 16
  • 70
  • 138
3
votes
0 answers

PHAsset not working on iOS 11

I am facing crash on PHAsset on iOS 11 while fetching photos from some device like iPhone 7 +, Application crash on PHImageManager. Please check below error log for same, Incident Identifier: ECC7F773-6C80-4E89-B892-C998FABF9F46 Beta Identifier:…
Jaywant Khedkar
  • 5,941
  • 2
  • 44
  • 55
3
votes
0 answers

Clear cache in PHCachingImageManager

I want to clear cache from PHCachingImageManager as whenever I fetch a new high resolution image, it increases the memory by around 3-4 Mb depending upon the size of the image and eventually crashes the app. This is the code I'm using for caching…
atulkhatri
  • 10,896
  • 3
  • 53
  • 89
3
votes
1 answer

PHAsset CLLocation is not giving location same as photos app

We are fetching the latitude and longitude from PHAsset properties we are using CLGeocoder to reverseGeocodeLocation using following method. CLGeocoder * geoCoder = [CLGeocoder new]; [geoCoder reverseGeocodeLocation:loc…
AppleBee
  • 452
  • 3
  • 16