私はちょうど私の検索Table View Cell
(ラベルなどを追加)進化しました。しかし、今私が新しいコードを実行すると、ランダムSignal SIGABRT
は、アプリケーションをクラッシュさせます。古いバージョンは次のようになりました(正常に動作します)。ランダム信号SigabrtでカスタムTableViewCell
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as UITableViewCell?
if self.resultSearchController.active
{
cell!.textLabel?.text = self.filteredQuotes[indexPath.row].quote
cell!.detailTextLabel?.text = self.filteredQuotes[indexPath.row].person
}
else
{
cell!.textLabel?.text = self.quotes[indexPath.row].quote
cell!.detailTextLabel?.text = self.quotes[indexPath.row].person
}
return cell!
}
新しいコード(新機能/データを含む)。私はSearchCellと名付けられた素早いファイルでセルをカスタムセルに変更しました。セルのアウトレットだけが含まれています。この回答https://stackoverflow.com/a/30776750/5274566
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("ChoosenCell", forIndexPath: indexPath) as! SearchCell
if self.resultSearchController.active
{
cell.quoteLabel?.text = self.filteredQuotes[indexPath.row].quote
cell.personLabel?.text = self.filteredQuotes[indexPath.row].person
cell.WikiLabel?.text = self.filteredQuotes[indexPath.row].wikiLink
cell.OccupationLabel?.text = self.filteredQuotes[indexPath.row].Occupation
cell.LifeLabel?.text = self.filteredQuotes[indexPath.row].life
cell.NationLabel?.text = self.filteredQuotes[indexPath.row].Nation
cell.PersonImageView?.image = self.filteredQuotes[indexPath.row].image
}
else
{
cell.quoteLabel?.text = self.quotes[indexPath.row].quote
cell.personLabel?.text = self.quotes[indexPath.row].person
cell.WikiLabel?.text = self.quotes[indexPath.row].wikiLink
cell.OccupationLabel?.text = self.quotes[indexPath.row].Occupation
cell.LifeLabel?.text = self.quotes[indexPath.row].life
cell.NationLabel?.text = self.quotes[indexPath.row].Nation
cell.PersonImageView?.image = self.quotes[indexPath.row].image
}
return cell
}
を追った私は今日のためにコンセントのミッシングリンクを発見しようとしているが、全くそれを理解することはできません。テーブルビューを開くときにアプリケーションがクラッシュし、最初にAppDelegate
ファイルにエラーが発生すると表示されます。
私は(私もそれらが同一である新=旧バージョンを比較して)すべてのoutlets
、actions
、identifiers
をチェックする(そして正しいと新しいものにいくつかの変更)などStoryboard
で、そこにエラーが発生していないしています。
この便利なチュートリアルhttps://www.raywenderlich.com/10209/my-app-crashed-now-what-part-1に続いて、デバッガを使用してさらに深く検索しようとしました。新しいコードのこのブレークポイントは次のようになります。
このコードでは、このコードの可能な解決策を探しています。私はプログラマーに慣れていないので、すべての助けは非常に感謝しています。
セル識別子「ChoosenCell」は正しいですか?あなたの 'SearchCell'カスタムセルを登録しましたか?通常、SIGABRTはヌル・ポインタ・アクセスを意味します。その行をデバッグして、プロパティとIBOutletの間に接続がない理由をトレースします。 – x4h1d
StoryBoardまたはコードを使用していますか? – MCMatan
はい、どちらも正しいです - それは変です!デバッグして理由をトレースする最善の方法は何ですか?どうすればいいですか? @ x4h1d – Mate