Ios 单击按钮将Json数据传递给其他ViewCont`` roller Tableview
我正在开发一个ios应用程序..单击按钮将Json数组传递给其他UiViewController TableView,以在TableView中显示数据..在TableView中,数组数据传递给NSDictionary并使用Dictionary对象。错误为[_NSCFDictionary objectAtIndex:]:无法识别的选择器发送到实例0x7b115560']…请提前感谢Ios 单击按钮将Json数据传递给其他ViewCont`` roller Tableview,ios,Ios,我正在开发一个ios应用程序..单击按钮将Json数组传递给其他UiViewController TableView,以在TableView中显示数据..在TableView中,数组数据传递给NSDictionary并使用Dictionary对象。错误为[_NSCFDictionary objectAtIndex:]:无法识别的选择器发送到实例0x7b115560']…请提前感谢 // Button Click BBAuthorDetailViewController *BBAuthor
// Button Click
BBAuthorDetailViewController *BBAuthorDetail =[[UIStoryboard storyboardWithName:@"Main" bundle:nil]instantiateViewControllerWithIdentifier:@"BBAuthorDetail"];
[BBAuthorDetail setSelectionType:BBSelectionAuthorName];
_serverObj = [[Server alloc]init];
[_params setObject:_adDetailsObj.authorDetail forKey:@"author"];
[_serverObj BBAuthorNameWithParams:_params];
// BBAuthorDetail.data=resultsArray;
//NSIndexPath *indexPath = [BBAuthorDetail.tableview indexPathForSelectedRow];
BBAuthorDetail.data = [resultsArray objectAtIndex:indexPath.row];
NSLog(@"%@",resultsArray);
//[BBAuthorDetail setManagedObjectContext:self.managedObjectContext];
[self.navigationController pushViewController:BBAuthorDetail animated:YES];
UIViewController Table TO Show Data
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return _data.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *cellIdentifier = [NSString stringWithFormat:@"Cell-%li", (long)indexPath.row];
BBAdsCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
// AdDetails *_adDetailsObj = (AdDetails *)[_data objectAtIndex:indexPath.row];
// NSDictionary *dic = [_data objectAtIndex:indexPath.row];
//AdDetails *_adDetailsObj = [[AdDetails alloc]init];
if (cell == nil) {
cell = [[BBAdsCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
cell.row = indexPath.row;
//[cell setDelegate:self];
}
// Error Part
NSDictionary *dic = [_data objectAtIndex:0];
cell.textLabel.text = [dic objectForKey:@"post_author"];
return cell;
}
“数据”是字典类型,您尝试使用索引获取数据。这在字典中不可能。请替换此BBAuthorDetail.data=[resultsArray objectAtIndex:indexPath.row];到BBAuthorDetail.data=resultsArray;看见