1.put the Reachability.h
Reachability.m files in to
project folder
2.To
add the SystemConfiguration.framework framework
3.#import
"Reachability.h"
this
.m file
4.
#pragma
mark -
#pragma
mark Method for Check Internet Connection
- (void) updateInterfaceWithReachability: (Reachability*) curReach
{
NetworkStatus
netStatus = [curReach currentReachabilityStatus];
switch
(netStatus){
case
NotReachable:{ internetWorking
= 0; break; }
case
ReachableViaWiFi:{ internetWorking
= 1; break; }
case
ReachableViaWWAN:{ internetWorking
= 1; break; }
}
}
-(void)CheckInternetConnection
{
Reachability
* internetReach = [[Reachability
reachabilityForInternetConnection]
retain];
[internetReach
startNotifier];
[self
updateInterfaceWithReachability:internetReach];
}
- Where ever u want to put this
[self
CheckInternetConnection];
if
(internetWorking
== 0)
{
[loaderLoginInfoChk
stopAnimating];
loaderLoginInfoChk.hidesWhenStopped=YES;
[loaderLoginInfoChk
release];
self.view.userInteractionEnabled=YES;
UIAlertView
*alert=[[UIAlertView
alloc]initWithTitle:@""
message:@"No
Network Connection Available. Please Try again Later."
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert
show];
[alert
release];
}
else
{
}
No comments:
Post a Comment