1

I want to retrieve some meta data of a photo asset in the Photo library. Basically the name, type and location of it. I want to implement it as a command line utility in Swift.

Here is the code I have come up with

var allPhotos : PHFetchResult<PHAsset>? = nil let fetchOptions = PHFetchOptions() allPhotos = PHAsset.fetchAssets(with: .image, options: fetchOptions) 

But it fails to compile because of 'fetchAssets(with:options:)' is only available in macOS 10.15 or newer.

My app is targeted to run on 10.14 and my MBP is still running 10.14.

When I check the documentation page (https://developer.apple.com/documentation/photokit/phasset),

I can't find the os version information next to each API on the page.

enter image description here

What is the easiest way to find such information?

Also how can I make the code work for 10.14?

1 Answer 1

2

macOS Version Requirements

What is the easiest way to find such information?

It says on the page that 10.15+ is required:


enter image description here

Alternatives

Also how can I make the code work for 10.14?

Use fetchAssets(in:options:) (min 10.13) instead of fetchAssets(with:options:) (min 10.15).

Sign up to request clarification or add additional context in comments.

2 Comments

As a suggestion, I would download Kapeli's Dash and install the iOS documentation. I find it to be much easier to navigate than wading through web pages. Additionally, it's available offline.
@Adrian Thanks for the suggestion! Indeed if i have to dive into each method's webpage to find its support version it seems to be rather time-consuming.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.