以编程方式更改系统网络(代理)设置 [英] Programmatically Change System Network (Proxy) settings

查看:414
本文介绍了以编程方式更改系统网络(代理)设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一种方法,从一个Cocoa应用程序中更改系统网络设置(具体来说,代理设置)。我发现在 / Library / Preferences / SystemConfiguration 中有一个名为 preferences.plist 的文件,它有我想要的设置,但我不知道如何让系统处理对此文件的更改而不重新启动。

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.

可以通过编程方式,或者至少通过启动一些命令? (这个解决方案可能只有10.5.x,我假设)

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

由于我可以立即在系统偏好中更改这些设置,必须有一些方法,它只是eludes me ....

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

谢谢!

推荐答案

SystemConfiguration 框架,特别是代理字典(请参阅这里了解更多详情)。

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

这篇关于以编程方式更改系统网络(代理)设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆