Programmatically Change System Network (Proxy) settings

 ̄綄美尐妖づ 提交于 2019-12-03 13:40:49

问题


Is there a way, from within a Cocoa application to change the system network settings (specifically, the proxy settings). I've found that there is a file called preferences.plist in /Library/Preferences/SystemConfiguration that has the settings I want, but I can't figure out how to get the system to process changes to this file without rebooting.

Can this be done programmatically, or at least by launching some command? (This solution would probably be 10.5.x only, I'm assuming)

Since I can change these settings in System Preferences immediately, there must be some way, it just eludes me ....

Thanks!


回答1:


You want the SystemConfiguration framework, specifically the Proxies Dictionary (see here for more details).



来源:https://stackoverflow.com/questions/1096154/programmatically-change-system-network-proxy-settings

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