Note that there are some explanatory texts on larger screens.

plurals
  1. PONSServices not working
    text
    copied!<p>I've been trying to get NSServices working for my application recently with no success. I have set it up according to the documentation but it does not appear in the services menu ( however it does appear in the keyboard shortcuts section of the System Preferences as a service menu item) Anyway I set the service in my app controller like this:</p> <pre><code>[NSApp setServicesProvider:self]; </code></pre> <p>The method exposed is:</p> <pre><code>- (void) addDownloadService:(NSPasteboard *)pboard userData:(NSString *)userData error:(NSString **)error </code></pre> <p>My Info.plist then looks like this:</p> <pre><code>&lt;key&gt;NSServices&lt;/key&gt; &lt;array&gt; &lt;dict&gt; &lt;key&gt;NSReturnTypes&lt;/key&gt; &lt;array&gt; &lt;string&gt;&lt;/string&gt; &lt;/array&gt; &lt;key&gt;NSKeyEquivalent&lt;/key&gt; &lt;dict&gt; &lt;key&gt;English&lt;/key&gt; &lt;string&gt;S&lt;/string&gt; &lt;key&gt;Key equivalent (with command and shift)&lt;/key&gt; &lt;string&gt;S&lt;/string&gt; &lt;/dict&gt; &lt;key&gt;NSSendTypes&lt;/key&gt; &lt;array&gt; &lt;string&gt;NSStringPboardType&lt;/string&gt; &lt;string&gt;NSURLPboardType&lt;/string&gt; &lt;string&gt;NSRTFPboardType&lt;/string&gt; &lt;/array&gt; &lt;key&gt;NSPortName&lt;/key&gt; &lt;string&gt;MyApp&lt;/string&gt; &lt;key&gt;NSMessage&lt;/key&gt; &lt;string&gt;addDownloadService&lt;/string&gt; &lt;key&gt;NSMenuItem&lt;/key&gt; &lt;dict&gt; &lt;key&gt;English&lt;/key&gt; &lt;string&gt;MyNewService&lt;/string&gt; &lt;key&gt;default&lt;/key&gt; &lt;string&gt; MyNewService &lt;/string&gt; &lt;/dict&gt; &lt;/dict&gt; &lt;/array&gt; </code></pre> <p>I tried running the debug command with textedit like so: /Applications/TextEdit.app/Contents/MacOS/TextEdit -NSDebugServices com.companyname.MyApp</p> <p>which outputs the following: MyNewService (com.companyname.MyApp) is disabled in the services menu and disabled in the context menu, by the standard Services policy.</p> <p>Anyone any ideas why it might not be working?</p> <p>Thanks Colin</p>
 

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