I need to add a contextual menu item in Finder application for a custom file type. So I created a service using Apple Automator. When I specify for public.data in NSSendFileTypes context menu item appears normally on all type of files but when I use UTI specified in my application info.plist it doesn't work on defined custom file types. Could any one help to hint whether it is possible to use custom UTI filtration for Finder context menu item service at all and if yes what am I doing wrong or there could be any "know how" ?
Here is my info.plist file of service workflow file.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSServices</key>
<array>
<dict>
<key>NSMenuItem</key>
<dict>
<key>default</key>
<string>MyService</string>
</dict>
<key>NSMessage</key>
<string>runWorkflowAsService</string>
<key>NSRequiredContext</key>
<dict>
<key>NSApplicationIdentifier</key>
<string>com.apple.finder</string>
</dict>
<key&g开发者_开发知识库t;NSSendFileTypes</key>
<array>
<string>com.myapp.anytype</string>
</array>
</dict>
</array>
</dict>
</plist>
Here is the UTI declaration code from my application's info.plist.
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.archive</string>
</array>
<key>UTTypeDescription</key>
<string>Any type file format</string>
<key>UTTypeIdentifier</key>
<string>com.myapp.anytype</string>
<key>UTTypeReferenceURL</key>
<string>http://myapp.com</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>anytype</string>
</array>
</dict>
</dict>
</array>
I can see my application in the list of suggested apps for that type of file, so I suppose the declaration is correct.
Wanted to share what I did wrong. The file format I was exporting from my app was in the list of system UTIs so my UTI definition for that format couldn't be exported. I just used the one declared in the system. Thanks to voters!
精彩评论