// 注意:这个方法仅对iOS 5.0.x有效+(BOOL)isNetworkAvailable{//Via StackoverflowNSURL*url=[NSURLURLWithString:@"http://www.baidu.com"];NSURLRequest*request=[NSMutableURLRequestrequestWithURL:url];NSHTTPURLResponse*response=nil;[NSURLConnectionsendSynchronousRequest:requestreturningResponse:&responseerror:NULL];return(response!=nil);}-(void)viewDidLoad{[superviewDidLoad];// Do any additional setup after loading the view, typically from a nib.if(![[selfclass]isNetworkAvailable]){[[[UIAlertViewalloc]initWithTitle:@"No network"message:@"No networkNetwork unavailable!!!"delegate:selfcancelButtonTitle:@"OK"otherButtonTitles:@"Settings",nil]show];}}-(void)alertView:(UIAlertView*)alertViewdidDismissWithButtonIndex:(NSInteger)buttonIndex{if(buttonIndex!=0){[[UIApplicationsharedApplication]openURL:[NSURLURLWithString:@"prefs:root=General&path=Network"]];}}