0

I am trying to use the finder comment field of a file stored in the folder of my iOS application (I'm talking about local storage, not in the cloud). The function MDItemCreate that would enable me to do so easily is not available in iOS applications apparently, which must be why the build currently fails with the error warning : "Cannot find 'MDItemCreate' in scope". Apple documentation in fact states that this method is only available on MacOS.

I have tinkered with FileManager but it doesn't grant access to comments.

This topic seems related but the solution is quite opaque to me.

My understanding of Swift is rather limited, if you would be so kind as to provide a simple and detailed answer I'd be much grateful.

With thanks, Julien

1 Answer 1

2

I'm not completely certain, but messages like "Cannot find 'X' in scope" are often due to a forgotten import statement. MDItemCreate(_:_:) (docs) seems to be part of the Core Services framework, which has been part of iOS since iOS 12. Have you imported the framework?

You can do this (at the top of your .swift file) as follows:

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

1 Comment

Thank you for your quick reply. I had indeed added the import statement to both the app and ContentView files, to no avail... I have found a very clumsy yet efficient workaround, which includes much to my shame a deluge of awkward .txt files. Given that the application is only meant for my private use, this is enough. Again, thank you for your kind help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.