I want to check the network connection in my application. In my application, I have eight buttons on a directory page. When I click the button, I have to check the network connection, if the network connection is available, then I need to analyze the data and display it in a table. In my application, I basically parsed and loaded the web URLs into the web view and used web services. Now I have completed my application, but the overall performance of the application is a bit slow. So, what I think, I tested all the URL functions for connecting to the Internet. I also used reachability code (from Apple Docs). So, what code will be used in my applications to improve application performance.
Note:
In my customer feedback, compared to the application performance while working in WIFI, it is much faster and works in 3G (Mobile Services), the performance will be a little slow. So, how can I improve the performance of my application by checking my internet connection? Do I need to check the application in WIFI or 3G?
I used this code to test network connectivity in my applications,
NSStringEncoding enc;
NSError *error;
NSString *connected = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://www.apple.com"] usedEncoding:&enc error:&error];
if (connected == nil) {
NSString * infoString = [NSString stringWithFormat:@"Please check your connection and try again."];
UIAlertView * infoAlert = [[UIAlertView alloc] initWithTitle:@"Network Connection Error" message:infoString delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[infoAlert show];
[infoAlert release];
} else {
[self details:castString];
}
So, how can I improve application performance by checking my internet connection? and affects application performance?
Pugal source
share