iphone - How to show an alert when the server is not working properly? -


i getting list using url doing parsing using xml parser. server not working properly. how give alert when server not working properly. have given code below

-(nsmutablearray*)getcustomerlist:(nsstring *)count category:(nsstring *)acategory alphabetic:(nsstring *)alphabeticvalue favorite:(nsstring *)isfavoritestring {     [self updatestatus];     if (internetconnectionstatus == notreachable)      {          uialertview *reachblealert = [[uialertview alloc] initwithtitle:@"message"                                                                 message: @"no network available alert"                                                                delegate:self                                                        cancelbuttontitle:@"ok"                                                       otherbuttontitles: nil];         [reachblealert show];            [reachblealert release];         return 0;     }     else      {          nsstring *urlstring=@"http:getcustomerlist.jsp";         urlstring = [urlstring stringbyaddingpercentescapesusingencoding:nsutf8stringencoding];         [dataparser parsexmlfileaturl:[nsurl urlwithstring:urlstring]];         nsmutablearray *list =[dataparser getcustomerlistfromparser];         printf("\n url customer list%s",[urlstring utf8string]);         printf("\n customer list   %d",[list count]);         return list;     } } 

i sending parameter url return repctive list when returns 0 dispalying alert in view controller.

but when server not working how display alert.

please me out of this.

thank you, madan mohan.

in opinion : first perform request operation server response.

secondly catch the response received in bool variable .

finally when bool variable true perform desired operation [such parsing..] otherwise show alert message proper error message.


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -