Я работаю с приложением с вкладками. На одной из вкладок у меня есть контроллер tableView, встроенный как SplitView. Когда эта вкладка становится активной, я делаю 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;
}
singleUserDetail
илиuserDetailsArray
непосредственно перед сбоем? - person Phillip Mills   schedule 24.09.2012