Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

RookieAppler

macrumors member
Original poster
Mar 15, 2012
58
0
Code:
wifiReach = [ITMReachability reachabilityForLocalWiFi];
	[wifiReach startNotifier];
	
	NetworkStatus netStatus = [wifiReach currentReachabilityStatus];
    BOOL connectionRequired= [wifiReach connectionRequired];

switch (netStatus)
    {
        case NotReachable:
        {
            statusString = @"Access Not Available";
            connectionRequired= NO;
            break;
        }
            
        case ReachableViaWWAN:
        {
			NSLog(@"WWAN is reachable");
			wifiAvailable = YES;
            statusString = @"Reachable WWAN";
			UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Yes Reachable Login"
															message:@"Please enter the correct login details."
														   delegate:nil
												  cancelButtonTitle:@"OK"
												  otherButtonTitles:nil, nil];
			[alert show]
			;            break;
        }
        case ReachableViaWiFi:
        {
		
			wifiAvailable = YES;
			statusString= @"Reachable WiFi";
            break;
		}
    }
I have a login screen. On entering username and password app should check for WIFI/Cell and launch a web service. But on the device, when i turn off WiFi on purpose and try to use cell, it wont go ahead. I am stuck at login screen. How should i let my app work on cell(4g) as well.?If you need more info, please ask.Thanks
 
Last edited by a moderator:
Your code only checks for wwan which is wifi you need to check for a host traceability instead on the other interface.
 
Why are you specifically checking reachability for wifi. Why not use reachabilityForInternetConnection or reachabilityWithHostName if you need to check a particular host address

edit: for example, instead of

Code:
wifiReach = [ITMReachability reachabilityForLocalWiFi];

try

Code:
wifiReach = [ITMReachability reachabilityForInternetConnection];

Now, obviously you would maybe want to change the name of that to something other than wifiReach, but you get the idea
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.