Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to add item in Finder's contextual menu using services in Cocoa
    primarykey
    data
    text
    <p><BR> I would like to add an item in my Finder's contextual menu whenever I right-click on files or folders, and this menu being linked to a method of my Cocoa app.<BR> I am following CocoaDev's example and Apple's documentation, but I can't get the service being displayed.<BR> Here is my .h<BR></p> <pre><code>#import &lt;Cocoa/Cocoa.h&gt; @interface AppDelegate : NSObject &lt;NSApplicationDelegate,NSObject&gt; @property (assign) IBOutlet NSWindow *window; -(void)IClicked:(NSPasteboard *)pboard userData:(NSString *)data error:(NSString **)error; @end </code></pre> <p>.m</p> <pre><code>#import "AppDelegate.h" @implementation AppDelegate @synthesize window = _window; - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { [NSApp setServicesProvider:self]; } - (void)IClicked:(NSPasteboard *)pboard userData:(NSString *)data error:(NSString **)error { NSLog(@"I clicked"); } @end </code></pre> <p>and the extract of my Application-plist.info:</p> <pre><code>&lt;key&gt;NSServices&lt;/key&gt; &lt;array&gt; &lt;dict&gt; &lt;key&gt;NSKeyEquivalent&lt;/key&gt; &lt;dict&gt; &lt;key&gt;default&lt;/key&gt; &lt;string&gt;E&lt;/string&gt; &lt;/dict&gt; &lt;key&gt;NSMenuItem&lt;/key&gt; &lt;dict&gt; &lt;key&gt;default&lt;/key&gt; &lt;string&gt;My Application&lt;/string&gt; &lt;/dict&gt; &lt;key&gt;NSMessage&lt;/key&gt; &lt;string&gt;IClicked&lt;/string&gt; &lt;key&gt;NSPortName&lt;/key&gt; &lt;string&gt;TestService&lt;/string&gt; &lt;key&gt;NSSendFileTypes&lt;/key&gt; &lt;array&gt; &lt;string&gt;public.item&lt;/string&gt; &lt;/array&gt; &lt;key&gt;NSSendTypes&lt;/key&gt; &lt;array&gt; &lt;string&gt;NSPasteboardTypeString&lt;/string&gt; &lt;/array&gt; &lt;key&gt;NSRequiredContext&lt;/key&gt; &lt;dict&gt; &lt;key&gt;NSServiceCategory&lt;/key&gt; &lt;string&gt;public.item&lt;/string&gt; &lt;/dict&gt; &lt;key&gt;NSReturnTypes&lt;/key&gt; &lt;array&gt; &lt;string&gt;NSPasteboardTypeString&lt;/string&gt; &lt;/array&gt; &lt;/dict&gt; &lt;/array&gt; &lt;/dict&gt; </code></pre> <p>I uploaded the code to <a href="http://www.petits-suisses.ch/TestService.zip">http://www.petits-suisses.ch/TestService.zip</a>.</p> <p>What did I wrong, or is there any available Cocoa code I can download to understand what I did wrong ?<P> Thanks !</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload