Note: Before start coding download the afnetworking archive and add in your project from following link...
http://four-developers.com/documents/AFNetworking.zip
#pragma mark- AFNetworking
-(void)makeRestuarantRequests
{
NSURL *url = [NSURL URLWithString:@"http://four-developers.com/service1.svc/getdata/aa"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
//AFNetworking asynchronous url request
AFJSONRequestOperation *operation = [AFJSONRequestOperation
JSONRequestOperationWithRequest:request
success:^(NSURLRequest *request, NSHTTPURLResponse *response, id responseObject)
{
arrEmp = [[NSArray alloc]initWithObjects:responseObject, nil];
[self generateTableView];
tblemployee.dataSource = self;
}
failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id responseObject)
{
NSLog(@"Request Failed: %@, %@", error, error.userInfo);
}];
[operation start];
}
No comments:
Post a Comment