- 新開了個坑,記錄開發ios時遇到的坑,以及解決bug的方法
-
bug: unable to dequeue a cell with identifier dictCell - must register a nib or a class for the identifier
這個bug是因為和同學合作開發app時因為一開始沒用git,所以中途得整合一下代碼,他直接把我的tableViewController
復制過去,導致dictCell
也就是自己定義的tableViewCell
無法使用.
解決方法很簡單,bug提示說must register a nib or a class for the identifier,那就調用下面這行代碼,把它放進override func viewDidLoad(){}
函數中
self.tableView.register(UITableViewCell.self, forCellReuseIdentifier: "newDictCell")
- UITableViewCell和newDictCell換成你自己定義的名字即可