创建OS X服务 [英] Creating an OS X Service

查看:128
本文介绍了创建OS X服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建OS X服务。我找到了提供系统服务在苹果的文档,但我发现它不太清楚我究竟需要做什么。我目前正在使用一个应用程序来注册我的服务(认为会更直接 - 最终我想创建一个.service),但即使在注销/登录后,我的服务仍然不会出现在列表中

I'm trying to create an OS X Service. I found Providing System Services in Apple's documentation, however I'm finding it less than clear on what exactly I need to do. I'm currently using an application to register my service (thinking that would be more straight forward - eventually I'd like to create a .service), however even after a logout/login my service still doesn't appear in the list of services in the menu.

我遗漏的链接文档中缺少一些步骤?我觉得有一些注册步骤,以便操作系统知道我的服务(除了在该文档中列出的内容),但我不能找到任何东西。

Is there some step missing from the linked document that I'm missing? I feel like there is some registration step so that the OS knows about my service (in addition to what is listed in that doc), but I'm not able to find anything.

提前感谢。 :)

编辑:这里是我的Info.plist文件中的NSServices字典:

Here is my NSServices dictionary from my Info.plist file:

    <key>NSServices</key>
<array>
    <dict>
        <key>NSPortName</key>
        <string>POPrlTest</string>
        <key>NSMessage</key>
        <string>shortenUrlService</string>
        <key>NSSendTypes</key>
        <string>NSStringPboardType</string>
        <key>NSReturnTypes</key>
        <string>NSStringPboardType</string>
        <key>NSMenuItem</key>
        <dict>
            <key>default</key>
            <string>Shorten URL</string>
        </dict>
    </dict>
</array>


推荐答案

请务必先启动应用程式系统查看服务。
确保使用
- setServicesProvider在您的应用程序中注册服务处理程序:

Make sure you are launching your app first to get the system to see the Service. Make sure you are registering the services handler in your app using - setServicesProvider:

此外,检查控制台日志,有用的错误信息。

Also, check the Console log as that might give you some useful error info.

这篇关于创建OS X服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆