1. Error Message
<xcode_images>

Top error message
Bottom error message

<xcode_error messages>
2022-06-25 21:57:28.171236+0900 summer[21413:1092025] [Storyboard] Unknown class MainViewController in Interface Builder file.
2022-06-25 21:57:30.027662+0900 summer[21413:1092025] -[UIViewController presentCamera]: unrecognized selector sent to instance 0x145606ad0
2022-06-25 21:57:30.037278+0900 summer[21413:1092025] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController presentCamera]: unrecognized selector sent to instance 0x145606ad0'
*** First throw call stack:
..................... 중략
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController presentAlbum]: unrecognized selector sent to instance 0x14bf065c0'
terminating with uncaught exception of type NSException

<issue>
시뮬레이터 실행시 에러 발생하였다.
강의를 따라하면서 정신없이 하다 보니 놓친 부분이 있었던 것 같다.

storyboard에 구성한 아이콘 선택시 print("album") 구문으로 album이 출력되는 것이 아닌 에러가 출력...

<cause and effect>
처음에는 " *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController presentAlbum]"이하 메시지를 계속 보는데도 이해가 안되서 결국 제일 위의 줄부터 보았다.
"[Storyboard] Unknown class MainViewController in Interface Builder file." 라고 쓰인 문구를 보면서
최초 프로젝트 생성시 ViewController라고 나오는 파일을 MainViewController라고 변경을 해두었는데
여기서 딱 떠오른 것이 'inherit Module From Target' 이였다.

저 체크박스를 선택한 순간 정상적으로 print 문의 내용이 출력된다.

<reference>
인터넷 검색하니 원인으로 여러종류가 나오는데 참고 사항으로 넣어두겠다.

<검색한 결과로 찾은 추가적인 내용>
1. .swift파일에서 storyboard와 연결되어 있던 @IBoutlet파일이 삭제되어 storyboard에만 존재하는 경우
2. Inspector창에서 Inherit Moudle From Target이 체크되지 않은 경우UIView를 커스텀한것이 아닌, UITableViewCell과 같은것에서 시도한 경우

+ Recent posts