在iPhone中将NSMutableArray加载到表视图时无法识别选择器
当我尝试将数组内容放入表视图时,出现以下错误: 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' 这是我的代码:在iPhone中将NSMutableArray加载到表视图时无法识别选择器,iphone,uitableview,nsmutablearray,nsarray,tableview,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:]:未识别的选择器发送到实例0x
- (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"
)
可能
fullapp.soapResults
可能是NSString或[fullapp.soapResults objectAtIndex:0]
可能是NSString请检查fullapp.soapResults
。它可能在appDelegate中声明为NSString
。尝试将其设置为一个NSArray
[fullapp.soapResults objectAtIndex:0]是“daily.com.my”。您正在调用此字符串的objectAtIndex:indexPath.row