Questions tagged [photokit]

PhotoKit (also known as Photos Framework) is a framework that allows you to retrieve assets for display and playback, edit their image or video content, or work with collections of assets such as albums, moments, and iCloud Shared Albums. This framework is available in iOS 8.0 and later.

PhotoKit (also known as Photos Framework) is a framework that allows you to retrieve assets for display and playback, edit their image or video content, or work with collections of assets such as user albums, smart albums and iCloud Shared Albums. This framework is available in iOS 8.0 and later.

256 questions
1
vote
2 answers

PHAsset: What is 'assetSource'?

I am enumerating a PHFetchResult. If I do a println on the PHAssets being returned, I get this: 4CBE5A4F-90BD-438B-954E-6FF1B14538CD/L0/001 mediaType=1/0, assetSource=3, (2448x3264), creationDate=2014-10-15 14:20:12 +0000,…
BlueVoodoo
  • 3,626
  • 5
  • 29
  • 37
1
vote
0 answers

Detect when Photo Editing Extension will come to foreground?

It is possible the user would start editing a photo with my Photo Editing Extension, then they could close the app (Photos) only to return to it later. I am wondering how to handle changes to that asset. In the template, Apple doesn't handle any…
Jordan H
  • 52,571
  • 37
  • 201
  • 351
0
votes
1 answer

What are the available NSSortDescriptors for PHFetchOptions?

I'm working with Apple's sample code for PhotoBrowse. In the main view controller's viewDidLoad() method we have this code: let allPhotosOptions = PHFetchOptions() allPhotosOptions.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending:…
0
votes
1 answer

Can I pre-populate a search in iOS PHPicker?

Let's say I have an iOS "Cats" app that I want my users to select photos. Is there a way to open PHPicker with a search term pre-populated with "cats"?
0
votes
0 answers

iOS Photo Kit Filter screenshots, screen recordings and assets saved other apps

G'day For a photos processing application, I have to fetch and filter out images and videos saved from other applications and exclude screenshots and screen recordings. For screenshots I'm using PHAsset's PHAssetMediaSubtype property to filter the…
nsuinteger
  • 1,503
  • 12
  • 21
0
votes
1 answer

When uploading a large file from PHAsset, do I need to copy it a temp file?

I am trying to upload a file from an iOS device through Google resumable upload feature. What I've tried is the methods of PhotoKit and uploadTask(with:fromFile). extension ExampleViewController: PHPickerViewControllerDelegate { public func…
hjh5696
  • 53
  • 1
  • 7
0
votes
0 answers

PHAssetCollection.requestAuthorization(for:handler:) gives .denied on ExtensionKit

I am making macOS app with ExtensionKit. When I call PHAssetCollection.requestAuthorization(for:handler:) on my extension, it always gives .denied without any prompts. I've added com.apple.security.personal-information.photos-library key into…
Jinwoo Kim
  • 440
  • 4
  • 7
0
votes
1 answer

How to change the image name before saving it to my custom album here

I want to set the picture name to "PG-1000" and check if it was created before, if so, replace it. So I need to access the filename properties of the PHAssetChangeRequest. let myAlbumName = "CustomAlbum" var albumPlaceholder:…
richard
  • 3
  • 3
0
votes
1 answer

How to batch edit multiple photos in iOS photo library using PHAssetChangeRequest

I'm trying to apply a transform edit to photos that a user selects from their photo library. I have the following code: let options = PHContentEditingInputRequestOptions() options.canHandleAdjustmentData = { adjustmentData -> Bool in …
blabus
  • 795
  • 2
  • 14
  • 25
0
votes
1 answer

PHAsset Creation date - check if UTC time or not?

When getting CreateionDate of PHAsset, the time returned is in UTC format. In order to display it correctly, so as to meet user's expectation that e.g. captured image of sunset was in the evening hours, not in the middle of night or day (depending…
Michal.Jan008
  • 135
  • 11
0
votes
0 answers

Is there a way to tell when an PHAsset was added to a collection in PhotoKit?

I'm using PHAsset.fetchAssets to retrieve some assets from a PhotoKit collection. I need to be able to tell when an asset was added to a collection. I realize assets have a creationDate and modificationDate, but those refer to when the item was…
0x6A75616E
  • 4,696
  • 2
  • 33
  • 57
0
votes
1 answer

PhotoKit: How To Sort Photos Randomly

When fetching assets from the user's photo library, you must specify how you want the photos to be sorted. You do this by passing in a NSSortDescriptor(). There are a few completions, but I'm wondering if there's any way to pass in a "random…
Stoic
  • 945
  • 12
  • 22
0
votes
1 answer

PhotoKit: get full resolution offline asset preview, when the requested asset is in iCloud

When loading images from the photo library via PhotoKit, it can happen that the image is not downloaded from iCloud. In this case, a low-resolution "placeholder" version of that image is available locally if you browse it in the photos…
Falco Winkler
  • 1,082
  • 1
  • 18
  • 24
0
votes
0 answers

SwiftUI, Core Data, and PhotoKit: Views not updating when state changes (state management hell)

I'm learning Swift/SwiftUI by building a photo organizer app. It displays a user's photo library in a grid like the built-in photos app, and there's a detail view where you can do things like favorite a photo or add it to the trash. My app loads all…
Jake Z
  • 105
  • 7
0
votes
0 answers

Why does PHPickerViewController say "Unable to Load Photos"

I'm working on a project where I need the user to be able to select images from their camera roll. I was using a UIImagePickerController but for some reason it's not working anymore which I assume is because they've finally depricated the…