In Monotouch on an iPhone/iPo开发者_C百科d, how do I detect if there is an internet connection available?
The best way right now is to use this class from Miguel de Icaza's GitHub repository:
https://github.com/xamarin/monotouch-samples/blob/master/ReachabilitySample/reachability.cs
Its a static class with a lot of methods, so all you have to do is add it to your project and call, for example:
NetworkStatus status = Reachability.InternetConnectionStatus();
精彩评论