我刚刚购买了新的Mac,并从Appstore下载了Xcode(4.5.1)。默认情况下,当你创建一个新项目时(在我的情况下,使用启用了Storyboard的Master/Detail模板),它的目标是ios 6.0,并且我的iPhone上的项目已经升级到6.0。Xcode 4.5.1在ios 5.1.1上的ios二进制文件导致错误
要使用5.1.1在我的iPhone上运行它,我更改了部署目标。运行在5.1.1当一个项目,并将在UITableView中我得到以下错误显示:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason:' -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:]:
unrecognized selector sent to instance 0x1023b800'
这是trows错误
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
NSDate *object = _objects[indexPath.row];
cell.textLabel.text = [object description];
return cell;
}
从我以前的iPhone项目I'的代码米,用来在看到这下面的
if(cell == nil)
// Create the cell
但我认为我不需要以此为故事板已经得到了添加到UITableView的单元格。
任何提示..?
最佳regaards 奥伊斯坦
非常感谢。我没有看到新的方法与“forIndexPath”和旧的没有它之间的区别..! –
是的,我也是。我打这个的原因是因为我正在创建一个UITableViewController子类。这段代码是由Xcode自动生成的,但是被注释掉了。一旦我没有评论,它仍然编译(BC我使用iOS 6库作为基本SDK)。但在ios 5模拟器上运行会很难。 –