-
[iOS] IBDesignable 사용시 에러 기록프로그래밍/iOS 2021. 2. 23. 06:40
1.
Using class UIView for object with custom class because the class does not exist
2.
Failed to render and update auto layout status
Failed to load designables from path (null)
=> xcode 껐다키니까 됨
3.
Failed to render and update auto layout status for 클래스명
The agent threw an exception
=> Bundle 관련한 부분 수정해야 했음
private func commonInit(){ // Bundle.main.loadNibNamed("CustomView", owner: self, options: nil) // IB Designable 에러로 인해 아래와 같이 수정 let bundle = Bundle(for: CustomView.self) bundle.loadNibNamed("CustomView", owner: self, options: nil) addSubview(customView) customView.frame = self.bounds customView.autoresizingMask = [.flexibleHeight, .flexibleWidth] }
(수정 전)
(수정후)
참고:
[iOS] IB Designables - Failed to render and update auto layout status for ViewController: The agent threw an exception
최근 다시 iOS 앱을 만들면서 처음 보는 에러가 발생했다. 굳이 수정하지 않아도 앱은 잘 돌아간다. 때문에 처음에는 귀찮아서 무시하고 개발했지만 갈수록 눈에 거슬려서 구글링해보니 스택오
furang-note.tistory.com
해당 블로그 내용:
스택오버플로우 답변의 코멘트에 따르면
Interface Builder가 렌더링 할 때 Application 에서 돌아가는 게 아니기 때문에
Main Application Bundle이 없어서 이런 에러가 발생하는 거라고 한다.
이게 Xcode 상에서는 에러로 표시되고 실제 앱에서는 잘 돌아가는 이유인 것 같음
참고한 블로그들:
1. file's owner, class 설정하는 부분과 xib 파일안에 loadNib에 대한 부분 설명하는 부분:
(xib파일 내에서 file's owner의 custom class 설정과 view의 custom class 설정의 차이)
[Swift] 커스텀 뷰 xib 연결하기 : File’s Owner vs Custom Class
또 뭐가 다른건디요~~!🤔🤔
sujinnaljin.medium.com
XIB를 사용한 UIView Custom 제대로 이해하기
#iOS #XIB #UIView #Custom
medium.com
Nib파일 로딩 · Wireframe
nib 파일에서 뷰/뷰컨트롤러를 가져오기 UIView를 상속받은 커스텀 뷰를 작성할 때, 뷰의 서브 뷰들을 일일이 동적으로 구성하는 것보다 인터페이스 빌더를 통해서 구성하는 것이 더 편한 경우가
soooprmx.com
[iOS] CustomView 만들기
CustomView는 말그대로 나만의 View로 Xcode에서 제공하는 기본 View들을 조합하여 새로운 View를 생성하여 사용하는 방법이다. 준비물은 2가지 또는 3가지. 1) CustomView이름.xib 2) CustomView이름.swift 3) Cu..
furang-note.tistory.com
반응형'프로그래밍 > iOS' 카테고리의 다른 글
[iOS] hidesSearchBarWhenScrolling가 작동하지 않을 때 (0) 2021.03.13 [iOS] tableView.indexPath(for: UITableViewCell)이 nil이 반환될 때 (0) 2021.03.09 [iOS] safe area <-> super view 구분 (0) 2021.02.10 [iOS] Dynamic Font (0) 2021.02.10 [iOS] applicationWillResignActive(_:)가 호출되지 않을 때(푸시 알림) (2) 2020.10.11