Last active
August 29, 2015 14:02
-
-
Save mustafaibrahim989/b54d92d5a05d601e042f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CheckConnection.h | |
// Youxel Technology | |
// | |
// Created by Mustafa Ibrahim on 10/3/12. | |
// Copyright (c) 2012 Youxel Technology. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
#import "Reachability.h" | |
@interface CheckConnection : NSObject | |
+(BOOL) checkInternetConnection; | |
+(BOOL)hasNetworkConnection; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CheckConnection.m | |
// Youxel Technology | |
// | |
// Created by Mustafa Ibrahim on 10/3/12. | |
// Copyright (c) 2012 Youxel Technology. All rights reserved. | |
// | |
#import "CheckConnection.h" | |
@implementation CheckConnection | |
+(BOOL)hasNetworkConnection | |
{ | |
Reachability* reachability = [Reachability reachabilityForInternetConnection]; | |
NetworkStatus remoteHostStatus = [reachability currentReachabilityStatus]; | |
if(remoteHostStatus != NotReachable) { | |
return YES; | |
} | |
return NO; | |
} | |
+(BOOL) checkInternetConnection | |
{ | |
// return YES; | |
Reachability* reachability = [Reachability reachabilityForInternetConnection]; | |
NetworkStatus remoteHostStatus = [reachability currentReachabilityStatus]; | |
if(remoteHostStatus != NotReachable) { | |
return YES; | |
} | |
UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:@"" message:NSLocalizedString(@"Unable to connect to the internet. Please check your network and try again.", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"OK", nil) otherButtonTitles:nil]; | |
[alertView show]; | |
return NO; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment