Use this.
- (void)viewDidLoad {[super viewDidLoad];self.displayDataTableView.delegate = self;self.displayDataTableView.dataSource = self;self.dateArray = [[NSMutableArray alloc]init];self.amountArray = [[NSMutableArray alloc]init];self.urlSession = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];self.urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"API Name"]];self.dataTask = [self.urlSession dataTaskWithRequest:self.urlRequest completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { NSMutableDictionary *serverRes = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil]; // NSLog(@"...%@ ", serverRes); self.integer = [[serverRes objectForKey:@"Data"] count]; NSLog(@"************* = %lu", self.integer); for (int i=0; i<self.integer; i++) { [self.dateArray addObject:[[[serverRes objectForKey:@"Data"] objectAtIndex:i] objectForKey:@"Date"]]; [self.amountArray addObject:[[[serverRes objectForKey:@"Data"] objectAtIndex:i] objectForKey:@"TotalAmount"]]; } NSLog(@"Date Array : %@", self.dateArray);dispatch_async(dispatch_get_main_queue(), ^{ [self.displayDataTableView reloadData];});}];[self.dataTask resume];}- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {return 1;}- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {return self.integer;}- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {if(indexPath.row == 0){ UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"detailsCell" forIndexPath:indexPath]; return cell;}else{ UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"detailsTitle" forIndexPath:indexPath]; return cell;}}