티스토리 뷰
Swift/Debugging Notes
[오류] sender로 넘겨받는 sender.title(for: normal) 에서 값이 nil이 나올 때
ylog 2022. 1. 19. 14:58sender의 button의 class를 UIButton에서 내가 커스텀에 사용한 RoundButton으로 변경도 해보고 했지만, 계속 nil만 리턴한 오류.
guard let numberValue = sender.titleLabel?.text else { return }
print(numberValue)
로 수정하니 해결되었다.
왜 sender.title(for:)로 작성하면 nil이 발생하는지 원인은 미상이다.
나와 같은 문제를 해결한 게시글(https://stackoverflow.com/questions/70145242/how-to-get-the-current-title-of-a-button-in-swift)을 찾아보니 최근에 발생한 문제점인지 싶기도 하다.
'Swift > Debugging Notes' 카테고리의 다른 글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- Info.plist
- 네트워킹
- 2023년
- snapkit
- collectionViewCell
- CRAWL
- BeautifulSoup
- CollectionView
- 웹모바일
- 2024년
- http/1.1
- UITest
- Realm
- http/1
- Kotlin
- dismiss
- IntrinsicContentSize
- swift
- 클린 아키텍처
- equaltosuperview
- Clean Architecture
- IOS
- 유즈케이스
- 회고
- 오토레이아웃
- Autolayout
- 부스트캠프
- KeyChain
- XCTest
- 스위프트
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
글 보관함