如何使用 MonoTouch 检查互联网访问?我不在乎互联网是来自 WIFI 还是来自 Cell Network,我只关心是否有互联网接入。
问问题
5559 次
1 回答
20
使用 Miguel 的 Reachability 类(可在此处找到:https ://github.com/xamarin/monotouch-samples/blob/master/ReachabilitySample/reachability.cs ),您可以这样称呼它:
if(!Reachability.IsHostReachable("http://google.com")) {
// Put alternative content/message here
}
else
{
// Put Internet Required Code here
}
希望这可以帮助,
克里斯NTR
于 2009-12-25T20:03:11.370 回答