-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNetworkCheck.m
43 lines (38 loc) · 1.2 KB
/
NetworkCheck.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//
// NetworkCheck.m
// appbuildr
//
// Created by Isaac Mosquera on 9/8/09.
// Copyright 2009 __MyCompanyName__. All rights reserved.
//
#import "NetworkCheck.h"
#import "Reachability.h"
@implementation NetworkCheck
BOOL hasShowedMessage = NO;
+ (BOOL)hasInternet {
NetworkStatus internetConnectionStatus = [[Reachability reachabilityForInternetConnection] currentReachabilityStatus];
if ( internetConnectionStatus == NotReachable ) {
if( !hasShowedMessage) {
hasShowedMessage = YES;
NSString *hostNotReachable =
[[NSString alloc] initWithFormat: @"Unable to download new content because your iphone does not have connectivity to the Internet.\n\nPlease retry when you establish connectivity."];
UIAlertView *uiAlert = [[UIAlertView alloc]
initWithTitle:@"http error" message:hostNotReachable delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[uiAlert show];
[uiAlert release];
[hostNotReachable release];
}
return NO;
} else {
return YES;
}
}
+ (BOOL)hasWiFi{
NetworkStatus networkIsWiFi = [[Reachability reachabilityForInternetConnection] currentReachabilityStatus];
if ( networkIsWiFi == ReachableViaWiFi) {
return YES;
} else {
return NO;
}
}
@end