
こんにちは!日々エラーに悩まされている独学者です!
今日もまた新たなエラーにぶち当たったので解決方法をまとめておきます!
目次
エラー概要・背景
Table cell内にボタンを配置してビルドしたところ、エラーが発生しました。ビルド自体は成功します。
AppDelegate.swiftのファイル(いじってない)が表示され、エラー文として、
Thread1 : “[<UITableViewCell 0x14062c8b0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key “ボタン名”
が出てきました。下部コンソールでは、
this class is not key value coding-compliant for the key “ボタン名”.
とのこと。何かボタンがうまく表示できないよ〜と言ってますね。


解決方法:Connections Inspector, Identity Inspectorを確認
これは、設置したボタンやラベルなどと、コードがうまく連携できていないことが原因のようです。


私は、ボタンを配置したTable cellを確認したところ、Moduleが空白+下部にある”Inherit Module From Target”のチェック無し、が原因でした。
ClassとModuleがしっかり記載されていないとエラーが出やすいので気をつけてください。これ以外にもいろんなエラーが出ています。
あわせて読みたい




【独学でSwift勉強してApp開発を目指す】直面したエラーまとめ
ある程度swiftを触ってきて、エラーの種類も増えてきたのでまとめました。 https://www.mechengjp.com/?p=163 https://www.mechengjp.com/?p=168 https://www.mechengjp...
もしボタンの名前を変更した、連結を直近でした場合は、Connections Inspectorも調べてください。


Outletsのところなどで、古いボタン名が残っていたりします。確実に消すようにしましょう。
コメント