macos - 操作系统: How to have a dedicated application for managing the preferences of another one

标签 macos cocoa preferences

我的主应用程序是不露面的(Dock 中和菜单栏中都没有图标),我想开发另一个应用程序来管理首选项。

我怎样才能实现这一目标(对于那些知道这个应用程序的人来说,就像 AlfredApp 一样)?

最佳答案

理论上你可以使用NSUserDefaults的addSuiteNamed:方法。苹果的文档说,关于这个方法:

The suiteName domain is similar to a bundle identifier string, but is not tied to a particular application or bundle. A suite can be used to hold preferences that are shared between multiple applications.

无论如何,这将允许您写入该应用程序的 NSUserDefaults。

话虽如此,如果您的应用程序是沙盒的(又名:您正在为 Mac App Store 编写它),那么使用 NSUserDefaults - 或任何其他首选项文件写入方法 - 将受到限制。因此,根据您对应用/分发方法的目标,也许您应该修改您的计划。

关于macos - 操作系统: How to have a dedicated application for managing the preferences of another one,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20731812/

相关文章:

java - 在 Java 中存储一个 String 变量以备后用

安卓 : Set a preference's summary in a main preference screen to the values selected in a sub preference screen

macos - Mac SQLite 编辑器

objective-c - 带有字体系列列表的 NSPopButton

cocoa - NSArrayController 获取与过滤谓词

ios - 是否需要回到主线程更新UI?

eclipse - 维护一组通用的 Eclipse 首选项

macos - 如何获取 NSImage 背后的*原始*数据?

macos - 如何使用 pkgbuild 为 $HOME 指定默认安装位置?

macos - 使用 Homebrew 软件在 OSX 上安装后无法运行 gearmand