【问题标题】:Getting notified when the network connection changes in a Cocoa / Obj-C application当 Cocoa / Obj-C 应用程序中的网络连接发生变化时收到通知
【发布时间】:2010-10-27 02:23:22
【问题描述】:

有什么方法可以通知/让您的 Cocoa 应用程序监听网络连接的变化(断开连接、连接等)? HardwareGrowler 之类的东西是怎么做到的?

【问题讨论】:

    标签: objective-c cocoa events networking listener


    【解决方案1】:

    查看HardwareGrowler 的源代码后(在source code for Growl 中的/Extras 下找到,我认为最简单的方法是使用NetworkNotifier.m 类并将所有对AppDelegate 函数的调用更改为当网络连接发生变化时你想要执行的任何回调(并为他们的代码提供功劳!)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-10-20
      • 2023-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-07-22
      相关资源
      最近更新 更多