将NSMutableArray加载到iPhone中的表视图时无法识别的选择器

时间:2011-03-17 08:04:49

标签: iphone uitableview nsmutablearray nsarray tableview

当我尝试将数组内容放入表视图时,我收到此错误:

  

2011-03-17 15:54:13.142 FullApp [6851:207] - [NSCFString objectAtIndex:]:无法识别的选择器发送到实例0x5903860

     

2011-03-17 15:54:13.143 FullApp [6851:207] * 由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:' - [NSCFString objectAtIndex:]:无法识别的选择器已发送例如0x5903860'

这是我的代码:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}

// Configure the cell.
FullAppAppDelegate *fullapp = (FullAppAppDelegate *)[[UIApplication sharedApplication]delegate];

NSString *cellValue = [[fullapp.soapResults objectAtIndex:0] objectAtIndex:indexPath.row];

cell.textLabel.text = cellValue;

这是我的数组内容:

2011-03-17 16:00:29.976 FullApp[6898:207] (
"Everyday.com.my",
"Mydeals.com.my"
)

3 个答案:

答案 0 :(得分:1)

[fullapp.soapResults objectAtIndex:0]是" Everyday.com.my"。您正在调用此字符串的objectAtIndex:indexPath.row。

答案 1 :(得分:0)

可能fullapp.soapResults可能是NSString,或者[fullapp.soapResults objectAtIndex:0]可能是NSString

答案 2 :(得分:0)

请检查fullapp.soapResults。它可能在appDelegate中声明为NSString。尝试将其设为NSArray

相关问题