阅读另一个应用程序的首选项 plist,或分享一些首选项?

发布于 2025-01-02 05:14:50 字数 97 浏览 6 评论 0原文

我想分享两个应用程序(游戏及其编辑器)之间的偏好。我怎样才能最好地完成这个任务?我认为游戏可以明确地从编辑器的首选项 plist 中读取,但我不确定实现这一点的最干净的方法是什么。

I'd like to share a preference between two apps (a game and its editor). How can I best accomplish this? I thought the game could explicitly read from the editor's preferences plist, but I'm not sure what the cleanest way to achieve this is.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

愿与i 2025-01-09 05:14:50

NSUserDefaults 维护要搜索的域列表。默认情况下,它只查看应用程序的首选项文件,但您可以让它搜索其他位置。

您可以执行以下操作:

NSUserDefaults *defaults = [[NSUserDefaults alloc] init];
[defaults addSuiteNamed:@"com.example.game.shared-prefs"];

在应用程序之间共享首选项。

NSUserDefaults maintains a list of domains to search. By default it just looks at your application's preferences file, but you can have it search other places.

You can do something like this:

NSUserDefaults *defaults = [[NSUserDefaults alloc] init];
[defaults addSuiteNamed:@"com.example.game.shared-prefs"];

To share preferences between apps.

自找没趣 2025-01-09 05:14:50

只需下拉至 CFPreferences API 即可获取专家参数。 NSUserDefaults 的首选项理念适用于应用程序,但 CFPreferences 允许您为所需的多应用程序首选项类型定义主机、套件等。

Just drop down to CFPreferences APIs for the expert parameters. NSUserDefaults' idea of preferences is for an app, but CFPreferences allow you to defines hosts, suites, and so on for the type of multi-app preferences you want.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文