gpt4 book ai didi

objective-c - LSUIElement代理应用程序更新核心数据后,如何通知其他应用程序?

转载 作者:行者123 更新时间:2023-11-30 13:03:40 24 4
gpt4 key购买 nike

我正在开发两个应用程序。主应用程序是一个常规的 cocoa 应用程序,用于显示核心数据中的数据。另一个是 LSUIElement 代理,负责更新主应用程序使用的存储在核心数据中的数据。这两个应用程序应该位于同一个 bundle 中。

现在我不知道在代理应用程序更新数据源后如何通知主应用程序从核心数据刷新其 View 。它们共享相同的 NSPersistentStoreCoordinator。

我想首先使用 NSDistributedNotificationCenter。但似乎并不高效和优雅。

在 macOS 上的进程或应用程序之间进行通信是否有最佳实践?

感谢您的帮助或建议。

最佳答案

您可以使用Distributed Objects

The Objective-C runtime supports an interprocess messaging solution called “distributed objects.” This mechanism enables a Cocoa application to call an object in a different Cocoa application (or a different thread in the same application). The applications can even be running on different computers on a network.

关于objective-c - LSUIElement代理应用程序更新核心数据后,如何通知其他应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39632431/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com