我剛剛購買了新的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模擬器上運行會很難。 –