Set System Preferences using Objective-C

江枫思渺然 提交于 2019-12-11 11:08:31

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/5369692/set-system-preferences-using-objective-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!