开发者

Getting notified when the network connection changes in a Cocoa / Obj-C application

开发者 https://www.devze.com 2023-01-21 08:13 出处:网络
Is there any way to be notif开发者_StackOverflowied / have your Cocoa application listen for changes in the network connection (disconnect, connect, etc.)? How does something like HardwareGrowler do i

Is there any way to be notif开发者_StackOverflowied / have your Cocoa application listen for changes in the network connection (disconnect, connect, etc.)? How does something like HardwareGrowler do it?


After looking at the source code for HardwareGrowler (found under /Extras in the source code for Growl, I figure that the easiest way would be to use the NetworkNotifier.m class and change all calls to AppDelegate functions to whatever callbacks you want executed when the network connection changes (and give them credit for their code!).

0

精彩评论

暂无评论...
验证码 换一张
取 消