Question

I'm making an app which uses internet. I remember there was something developers had to do with CFNetwork or similar regarding check if availability or speed.

Is there some kind of standard UIAlertView with the message "It seems you have no internet, but you need it for this app"?

Is there a tutorial or guide which show how to do it?

Était-ce utile?

La solution

Apple provides Reachability class to check for this,

Here is a very simple and effective example.

http://tympanus.net/codrops/2009/09/14/checking-network-reachability-iphone/

UPDATE:

It seems that Apple has updated their reachability class and included the singleton pattern. You can check out the new classes here... http://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html

thanks @Proud Member for pointing it out.

Autres conseils

To test and monitor network availability, you should use the Reachability class in Apple's sample code - http://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html

There's no standard alert for lack of network availability - how you handle the situation depends on the app you're writing.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top