使用 Objective-C 设置系统首选项
这可能是微不足道的,但是我在网上找不到任何信息:How can I set any Apple favorites using code?我想为自己创建一个小应用程序,当我单击按钮时设置某些首选项。例如我想关闭蓝牙和 Wi-Fi。据我所知,这些首选项存储在 /Users/fabian/Library/Preferences/com.apple.*.plist
中。
那么:我如何更改这些首选项并确保它们得到应用?
This is probably trivial, however I couldn't find any information online: How can I set any Apple preference using code? I would like to create a little application for myself that sets certain preferences when I click a button. For instance I would like to turn off Bluetooth and Wi-Fi. As far as I know, these preferences are stored in /Users/fabian/Library/Preferences/com.apple.*.plist
.
So: how can I change these preferences and make sure they are applied?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
CoreFoundation CFPreferences API 允许编辑当前应用程序默认域之外的默认值。
请注意,您可能需要管理权限才能编辑许多与网络相关的默认值。
The CoreFoundation CFPreferences API allows for editing of defaults outside of the current application's defaults domain.
Note that you'll likely need administrative privileges to edit many network related defaults.