Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 5    Views: 47

Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
08/14/13 08:22 AM (12 years ago)

How to design around NetworkState?

Code Guru's..... Ive seen that when you open your app and you have you iDevice in AirPlane mode (or no connectivity) it outputs in the log, messages like: "BT_networkState: Monitoring Connection: WiFi Not Available". Can i code around this result ? So for example...in a plugin i might want if ([NetworkState = WiFi Not Available]) { Alert box saying "You have no connectivity, data will not populate" }else{ carry on with Buzztouch code } This is to try and get rid of a please wait spinner that just continues when you have no data connectivity any thoughts? Thanks Steve
 
nadthevlad
Code is Art
Profile
Posts: 1025
Reg: Jun 07, 2012
Denver
21,850
like
08/14/13 11:53 AM (12 years ago)
I would start by searching the project for that log message. Once you know where this is getting generated it should be fairly easy to set up an alert box and stop the spinner.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
08/14/13 01:27 PM (12 years ago)
I try to keep my stuff 'offline' although it's not an offline app. I set a boolean value for the network connection status, and then test for boolean in critical areas. Cheers! -- Smug
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
08/14/13 02:01 PM (12 years ago)
Thanks. I worked it out eventually after some googling and stack overflow
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
08/14/13 02:02 PM (12 years ago)
Reachability *networkReachability = [Reachability reachabilityForInternetConnection]; NetworkStatus networkStatus = [networkReachability currentReachabilityStatus]; if (networkStatus == NotReachable) { NSLog(@"There IS NO internet connection"); [self.pleaseWait setHidden:YES]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Connection" message:@"InApp purchases cannot be made whilst you have no data connection" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil]; [alert show]; [alert release];
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
08/14/13 02:24 PM (12 years ago)
I couldn't paste any code until after the webinar. Sorry! :) Cheers! -- Smug
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.