Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ipad 在tabbar控制器中与uisplitviewController一起使用时,tableView上的重新加载数据会崩溃_Ipad_Uitabbarcontroller_Uitableview_Uisplitviewcontroller_Ios5.1 - Fatal编程技术网

Ipad 在tabbar控制器中与uisplitviewController一起使用时,tableView上的重新加载数据会崩溃

Ipad 在tabbar控制器中与uisplitviewController一起使用时,tableView上的重新加载数据会崩溃,ipad,uitabbarcontroller,uitableview,uisplitviewcontroller,ios5.1,Ipad,Uitabbarcontroller,Uitableview,Uisplitviewcontroller,Ios5.1,我正在使用一个tabbar应用程序。在其中一个选项卡中,我将tableView控制器嵌入为SplitView。当此选项卡变为活动状态时,我会进行URL调用以从服务器获取一些数据。我无法在tableView中填充数据。我尝试了“[self.tableView reloadData]”,但应用程序崩溃。我的ViewController类是UITableViewController的子类 - (void)didReceiveUserListFromServer { NSData *jsonData =

我正在使用一个tabbar应用程序。在其中一个选项卡中,我将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;
}

我会尝试将
userDetailsArray
设置为类中的strong属性,并使用
self.userDetailsArray
设置其值和引用

(奇怪的是,数组对
计数有效,对以后的访问无效,但释放的内存似乎是最符合逻辑的解释。)


您还可以尝试为您的构建方案打开僵尸,看看这是否提供了更好的信息。

如果在崩溃前记录
singleUserDetail
userDetailsArray
的值,您会看到什么?@PhillipMills It崩溃时没有记录任何值。