2011-03-17 54 views
0
表視圖時

我得到這個錯誤,當我試圖把我的數組內容到表視圖:無法識別的選擇器加載的NSMutableArray到iPhone

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" 
) 

回答

1

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

0

大概fullapp.soapResults可能是一個的NSString或[fullapp.soapResults objectAtIndex:0]可能是一個的NSString

0

請檢查fullapp.soapResults 。它可能在appDelegate中聲明爲NSString。嘗試使它成爲NSArray

相關問題