タブバーアプリケーションを使用しています。タブの1つに、SplitViewとして埋め込まれたtableViewコントローラーがあります。このタブがアクティブになったら、URL呼び出しを行って、サーバーからデータを取得します。tableViewにデータを入力できません。'[self.tableView reloadData]'を試しましたが、アプリケーションがクラッシュします。私のViewControllerクラスはUITableViewControllerにサブクラス化されています。
- (void)didReceiveUserListFromServer
{
NSData *jsonData = responseData;
NSError *error=nil;
NSMutableDictionary *responseDict = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONWritingPrettyPrinted error:&error];
userDetailsArray = [responseDict objectForKey:@"userDetails"];
NSLog(@"count===%d",[userDetailsArray count]); //This returns a non-zero number
[self.tableView reloadData];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [userDetailsArray count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"ReturningPatientSearchResultCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
NSMutableDictionary *singleUserDetail = [userDetailsArray objectAtIndex:indexPath.row];
cell.textLabel.text=[singleUserDetail objectForKey:@"Name"]; //EXC_BAD_ACCESS here
return cell;
}