プログラミングスクール最大70%OFF! ←クリックして見に行く

【Error】The document “BarcodeVCStoryboard.storyboard” could not be opened. Multiple elements have the IDs “xxx”, and “xxx”

【Error】The document “BarcodeVCStoryboard.storyboard” could not be opened. Multiple elements have the IDs “xxx”,  and “xxx”

エラー解消方法の備忘録_φ(・_・ )

発生したエラー

The document “BarcodeVCStoryboard.storyboard” could not be opened. Multiple elements have the IDs “ZR1-sG-pyp”, “mia-Rh-5NA”, “sia-0Z-H1S”, and “zYN-u1-vvC”
This may be due to an invalid source control merge. If available, consider reviewing the merge history of this document.

翻訳

ドキュメント “BarcodeVCStoryboard.storyboard “を開くことができませんでした。複数の要素が “ZR1-sG-pyp”, “mia-Rh-5NA”, “sia-0Z-H1S”, “zYN-u1-vvC” というIDを持っています。

これは、無効なソースコントロールマージが原因である可能性があります。もし可能であれば、このドキュメントのマージ履歴を確認してみてください。

原因

StoryBoard内のUI(ボタン、ラベル、テキストフィールド等)に設定されているIDが競合することによって出るエラー

💡point
UIのIDは一意である必要があります\_(・ω・`)ココ重要!

解決手順①

・xibまたはstoryboardの右クリックメニューからソースコードとして開く
・エラーに表示されているID で検索
・複数の参照が表示されるので、不要なものを削除する
・クリーンビルドする

📝memo
重複しているIDを一意のIDに変更することでエラーが解消する方法もありますが、
不要なUIが重複している場合は、削除しないとおかしなことになる。

解決手順②

・新しくstoryboardを作成する
・storyboardをソースコードで開く
・.xmlの タグ内をコピーする
・新しく作成したstoryboardのと入れ替える
・クリーンビルドする

参考サイト

https://stackoverflow.com/questions/34218388/the-document-main-storyboard-could-not-be-be-opened
https://stackoverflow.com/questions/25377730/xcodethe-identifier-ibmemberid-xxx-xx-xxx-is-already-in-use-by-ibuitableview/
https://stackoverflow.com/questions/34218388/the-document-main-storyboard-could-not-be-be-opened

Swiftカテゴリの最新記事