According to me.
The Best way is to use sendAsynchronousRequest
with block coding
enum for the webservice respoce.
typedef void (^onGetSuccess)(BOOL success,NSArray *arrProduct);
**Webservice Calling**
-(void)getData:(onGetSuccess)block{
[NSURLConnection sendAsynchronousRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:GET_SERVERT_URL]] queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
if ([data length]>0) {
NSString *str=[[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];
NSDictionary *dict=[NSDictionary dictionaryWithXMLString:str];
NSMutableArray *arrRespoce=[dict objectForKey:@"dict"];
block(YES,arrRespoce);
}
else{
block(false,nil);
}
}];
}
For the xml to dict convertion