고도고도
🍎🍏
고도고도
전체 방문자
13,424
오늘
31
어제
64
  • 분류 전체보기 (170)
    • 🔨 프로젝트 (0)
      • TP 1 (0)
      • WhiteHCCTV (0)
      • FootPrint (0)
    • 💻 개발 (61)
      • iOS (28)
      • Android (6)
      • Kotlin (4)
      • Flutter (9)
      • Node.js (5)
      • Architecture (1)
      • 오늘의 삽질 (7)
      • 에러와의 동침 (1)
    • ✏️ 알고리즘 (6)
      • Graph (6)
      • String (0)
      • Sort (0)
    • ✍️ 코테 준비 (44)
      • Math (1)
      • Implementation (3)
      • String (3)
      • Brute Force (5)
      • Back Tracking (7)
      • Greedy (0)
      • Dynamic Programming (13)
      • Binary Search (1)
      • DFS, BFS (5)
      • Shortest Path (2)
      • Two Pointer (4)
      • MST (0)
    • 📚 CS (6)
      • Operating System (6)
    • ⛹️ 라이프 (53)
      • 2020 겨울방학 모칵코(팀) (13)
      • 2020 겨울방학 모각코(개인) (13)
      • 2021 여름방학 모칵코(팀) (8)
      • 2021 여름방학 모각코(개인) (7)
      • 코딩 테스트 (1)
      • 회고 (10)

블로그 메뉴

  • 홈
  • 깃허브
  • 링크드인

공지사항

인기 글

  • [NCSOFT] 2022 엔씨소프트 썸머 인턴 후기 - 1⋯
    2022.08.10
    [NCSOFT] 2022 엔씨소프트 썸머 인턴 후기 - 1⋯
  • [Flutter] SingleChildScrollView,⋯
    2021.08.18
    [Flutter] SingleChildScrollView,⋯
  • [iOS / SwiftUI] MapKit, 실시간으로 도로⋯
    2022.12.20
    [iOS / SwiftUI] MapKit, 실시간으로 도로⋯
  • [Android] 백그라운드에서 소켓 통신으로 이벤트 수신⋯
    2022.06.08
    [Android] 백그라운드에서 소켓 통신으로 이벤트 수신⋯
  • [iOS / SwiftUI] OnAppear, OnDisa⋯
    2022.12.01
    [iOS / SwiftUI] OnAppear, OnDisa⋯

최근 댓글

  • https://developer.apple.com/docu⋯
    고도고도
  • 게시글 잘 보았습니다. 혹시 주소에서 구를 가지고 오시는⋯
    나그네
  • 혹시 댓글이 안보이는데 .. y2e010924@naver.⋯
    eun
  • 글 솜씨가 뛰어나시네요! 좋은 글 잘 보고 갑니다 다음에도⋯
    alpha-traveler
  • NC......가슴이...웅장해집니다.......🤯
    이상한핑구 🐧

최근 글

  • [Architecture] MVVM + Clean Arch⋯
    2023.01.07
    [Architecture] MVVM + Clean Arch⋯
  • [iOS / SwiftUI] MapKit, 실시간으로 도로⋯
    2022.12.20
    [iOS / SwiftUI] MapKit, 실시간으로 도로⋯
  • [iOS / SwiftUI] OnAppear, OnDisa⋯
    2022.12.01
    [iOS / SwiftUI] OnAppear, OnDisa⋯
  • [에러와의 동침] 22년 11월 4주차
    2022.11.28
    [에러와의 동침] 22년 11월 4주차
  • [iOS / SwiftUI] 스크롤, 무한으로 즐겨요~ (⋯
    2022.11.28
    [iOS / SwiftUI] 스크롤, 무한으로 즐겨요~ (⋯

티스토리

hELLO · Designed By 정상우.
고도고도

🍎🍏

[iOS / Swift] unable to dequeue a cell with identifier Cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard
💻 개발/오늘의 삽질

[iOS / Swift] unable to dequeue a cell with identifier Cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard

2022. 8. 21. 14:52

TableView를 사용하면서 Cell을 재사용하기 위해 extension으로 UITableViewDataSource를 재정의하고 빌드를 진행했다.

extension ViewController : UITableViewDataSource {
    func tableView(_ tableView : UITableView, numberOfRowsInSection section : Int) -> Int {
        return self.tasks.count
    }
    
    func tableView(_ tableView : UITableView, cellForRowAt indexPath : IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for : indexPath)
        let task = self.tasks[indexPath.row]
        
        cell.textLabel?.text = task.title
        
        return cell
    }
}

 

앱은 정상적으로 실행됐지만 새로운 task를 등록하면 아래와 같은 오류가 발생했다.

unable to dequeue a cell with identifier Cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard

 

해석해보면 스토리보드의 셀과 연결되어 있지 않다는 오류였다. 

스토리보드에서 Cell의 identifier를 확인해보니 설정되어 있지 않았고 이를 Cell로 변경해줬더니 정상적으로 작동했다.

 

공식 문서에 써져있음!

참고

- tableView(_:numberOfRowsInSection:)

 

Apple Developer Documentation

 

developer.apple.com

- dequeueReusableCell(withIdentifier:for:)

 

Apple Developer Documentation

 

developer.apple.com

저작자표시 비영리 변경금지

'💻 개발 > 오늘의 삽질' 카테고리의 다른 글

[iOS / Swift] URL Encoding = nil...? (URL 인코딩이 되지 않을 때)  (1) 2022.09.22
[iOS / Swift] Exception NSException * "-[UIView setText:]: unrecognized selector sent to instance  (0) 2022.09.07
[Android / Gradle] mockup1/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: AAPT: error: failed to read PNG signature: file does not start with PNG signature.  (0) 2022.08.13
[Android / Gradle] The current Gradle version is not compatible with the Kotlin Gradle plugin  (0) 2022.08.09
[Android / Kotlin] Failed to call observer method  (0) 2022.03.30
    '💻 개발/오늘의 삽질' 카테고리의 다른 글
    • [iOS / Swift] URL Encoding = nil...? (URL 인코딩이 되지 않을 때)
    • [iOS / Swift] Exception NSException * "-[UIView setText:]: unrecognized selector sent to instance
    • [Android / Gradle] mockup1/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: AAPT: error: failed to read PNG signature: file does not start with PNG signature.
    • [Android / Gradle] The current Gradle version is not compatible with the Kotlin Gradle plugin
    고도고도
    고도고도
    iOS 꿀잼
    댓글쓰기
    [iOS / Swift] Exception NSException * "-[UIView setText:]: unrecognized selector sent to instance
    다음 글
    [iOS / Swift] Exception NSException * "-[UIView setText:]: unrecognized selector sent to instance
    [Android / Gradle] mockup1/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: AAPT: error: failed to read PNG signature: file does not start with PNG signature.
    이전 글
    [Android / Gradle] mockup1/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: AAPT: error: failed to read PNG signature: file does not start with PNG signature.

    티스토리툴바