Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you display a Alert when not connected to the internet ? iOS

hi How do you display a Alert when not connected to the internet ? iOS

not connected to internet means has no wifi , no connection to remote host ( www.google.com)

no Cellular Data Network

as i have seen many applications showing this message when i am not connected to the internet.

i have tried downloading the Reachability from apple dev resources however it does not give me what i want of implementing the codes into my .h .m file.

hope to get a reply.

like image 553
AlsonToh-SG Avatar asked Oct 14 '22 22:10

AlsonToh-SG


1 Answers

Code to do this is here.

http://developer.apple.com/library/ios/samplecode/Reachability/

You can call:

    self.remoteHostStatus           = [[Reachability sharedReachability] remoteHostStatus];
    self.internetConnectionStatus   = [[Reachability sharedReachability] internetConnectionStatus];
    self.localWiFiConnectionStatus  = [[Reachability sharedReachability] localWiFiConnectionStatus];
like image 99
Jordan Avatar answered Oct 31 '22 19:10

Jordan