0
我在代碼中有以下錯誤? 爲什麼?線程1:信號SIGABRT
主題1:singnal SIGABRT
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"SimpleTableItem";
UITableViewCell *cell1 = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell1 == nil) {
cell1 = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
}
cell1.textLabel.text = [tableData objectAtIndex:indexPath.row];
// create the parent view that will hold header Label
UIView* customView = [[[UIView alloc] initWithFrame:CGRectMake(0,0,320,78)] autorelease];
// create image object
UIImage *myImage = [thumbnails objectAtIndex:indexPath.row];
[cell1 addSubview:customView];
// Set up the cell...
// create the imageView with the image in it
UIImageView *imageView = [[UIImageView alloc] initWithImage:myImage];
imageView.frame = CGRectMake(0,0,320,78);
[customView addSubview:imageView];
cell1.imageView.image = [UIImage imageNamed:[thumbnails objectAtIndex:indexPath.row]];
NSLog(@"Hello Last");
return cell1;
}
行錯誤:
UIImageView *imageView = [[UIImageView alloc] initWithImage:myImage];
怎麼辦?從評論
錯誤消息:
TextFieldAlert[551:c07] -[__NSCFConstantString size]: unrecognized selector sent to instance 0x6fd4 TextFieldAlert[551:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString size]: unrecognized selector sent to instance 0x6fd4' *** First throw call stack: (0x14e0022 0xeb4cd6 0x14e1cbd 0x1446ed0 0x1446cb2 0x45662e 0x2df2 0x406c54 0x4073ce 0x3f2cbd 0x4016f1 0x3aad42 0x14e1e42 0x26b5679 0x26bf579\0\ 0x14b4195 0x1418ff2 0x14178da 0x1416d84 0x1416c9b 0x36ac65 0x36c626 0x275d 0x26d5 0x1) terminate called throwing an exception(lldb)
什麼是* *控制檯中的全部錯誤消息** –
TextFieldAlert [551:c07] - [__ NSCFConstantString size]:無法識別的選擇器發送到實例0x6fd4 TextFieldAlert [551:c07] ***由於未捕獲異常'NSInvalidArgumentException'而終止應用程序,原因:' - [__ NSCFConstantString size]:無法識別的選擇器發送到實例0x6fd4' ***第一擲調用堆棧: (0x14e0022 0xeb4cd6 0x14e1cbd 0x1446ed0 0x1446cb2 0x45662e 0x2df2 0x406c54 0x4073ce 0x3f2cbd 0x4016f1 0x3aad42 0x14e1e42 0x26b5679 0x26bf579 \ 0 \ 0x14b4195 0x1418ff2 0x14178da 0x1416d84 0x1416c9b 0x36ac65 0x36c626 0x275d 0x26d5爲0x1) 終止叫做拋出異常(LLDB) –