macos - 如何使用notificationconf?

标签 macos cocoa push-notification jabberd2

我已阅读THIS有关创建推送节点和发布/订阅通知的教程。 我遇到的唯一问题是 notificationconf 似乎无法创建该节点...

我的第一个问题:nodename(notificationconf工具的参数)和notificationName(我从应用程序中使用的NSString)是否相同?

第二:

notificationconf createnode push.example.com BFMyTestPushhNotification beefon
Enter password: // password from Open Directory for user beefon - it is Admin of the 10.6 server
2010-01-24 13:24:58.916 notificationconf[15221:903] created XMPP session
2010-01-24 13:24:58.931 notificationconf[15221:903] Connecting to push.example.com:5222 with user com.apple.notificationuser@push.example.com/TestPubsub, security = 2 ...
2010-01-24 13:24:59.130 notificationconf[15221:903] sessionCallback (event 1)
2010-01-24 13:24:59.130 notificationconf[15221:903] Session stopped (event 1)

我做错了什么? 从应用程序发布通知不会执行任何操作...

感谢您的帮助!

最佳答案

我一直在尝试将 Snow Leopard Server 的推送通知服务与基于 XMPP 发布-订阅的自定义应用程序结合使用。我努力创建一个节点,但终于弄清楚了。

  1. 追踪服务帐户com.apple.notificationuser的密码。例如,您可以在 /private/etc/dovecot/notify/notify.plist 中找到它。

  2. 使用 JID com.apple.notificationuser@your-chat-server-hostname.com 和该密码连接到您的推送通知服务器。

  3. 以正常方式创建节点。在XMPPFramework中是这样的:

    XMPPJID *serviceJID =
    [XMPPJID jidWithString:@"pubsub.your-chat-server-hostname.com"];
    XMPPPubSub *xmppPubSub = [[XMPPPubSub alloc] initWithServiceJID:serviceJID];
    [xmppPubSub createNode:@"pubsub.your-chat-server-hostname.com`
               withOptions:nil];
    
  4. 服务器创建节点。它以 iq 进行响应,但不是规范要求的。如果节点已经存在,它会发送一个合规错误。

    <iq xmlns="jabber:client"
    to="com.apple.notificationuser@your-chat-server-hostname.com/..."
    from="pubsub.your-chat-server-hostname.com"
    id="...:create_node" type="result"/>
    
  5. 使用同一用户进行连接以发布您的更新。

我始终无法让 notificationconf 正常工作。

关于macos - 如何使用notificationconf?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2126719/

相关文章:

macos - 如何在不升级依赖项的情况下使用 “port install”?

objective-c - 操作无法完成。 cocoa 错误 4

android - 为什么应用程序使用推送通知而不是 VPN(虚拟专用网络)?

iphone - 重置ios5中的推送通知权限设置

android - Android Notification 上的最长声音持续时间

ios - Xcode 8 图像补全

macos - 如何使用 Cocoa 解析 Carbon AppleEvent(NSAppleEventDescriptor?)

macos - LWJGL 不会给我支持 4.1 的 OpenGL 上下文

swift - 对成员 'close()' 的引用不明确

cocoa - NSPanel 父窗口 float 在全屏 NSView 之上