PDA

View Full Version : Editing metadata with Cocoa




scorpsjl
Jun 17, 2006, 03:18 AM
On another spotlight/metadata note, does anyone know how to edit metadata attributes with obj-C / Cocoa, given a file's url/path? I can't seem to pin it down. I'd like my app to be able to change various metadata attributes, as well as possibly add new ones. Anyone have any suggestions?

Thanks!



Catfish_Man
Jun 17, 2006, 12:17 PM
You'd have to replace the MDImporter for that file type.

scorpsjl
Jun 18, 2006, 05:23 PM
what if i just want to change the metadata for an individual file? How would I do that?

edit: I mean change the content, not edit the attributes themselves. Eg set the author datatype to author x, not change the author type itself.

robbieduncan
Jun 18, 2006, 05:38 PM
what if i just want to change the metadata for an individual file? How would I do that?

edit: I mean change the content, not edit the attributes themselves. Eg set the author datatype to author x, not change the author type itself.

Depends on the specific type of file. There is no generic API for this. You need to understand the specific file structure of the file. This is why to get the meta-data OSX relies on vendor provided importers for each type. The importers are one-way though: you can't use them to write back to the files.

scorpsjl
Jun 18, 2006, 07:18 PM
how about for PDF? Any way to do it?

robbieduncan
Jun 19, 2006, 02:32 AM
how about for PDF? Any way to do it?

What am I? Google?

Anyway Apple's PDFKit does not seem to provide these so you're either looking for a 3rd party library or Framework or implementing it on your own.