TextField 에 Binding 으로 연결하면 에러 발생
52
投稿した質問数 21
강의 내용중에
아래 2가지가 가능하다고 했는데
1번
TextField("이메일을 입력해주세요", text: $store.email.sending(\.inputEmail))2번
TextField("이메일을 입력해주세요", text: Binding(get: {
store.email
}, set: { email in
store.send(.inputEmail(email))
}))2번 코드로 작성후 이메일주소를 수정후
저장 하니깐 아래와 같은 에러가 발생했습니다.
A "forEach" at "AppStore/MyPageReducer.swift:96" received an action for a missing element.
Action:
MyPageStackReducer.Action.email(.inputEmail)
This is generally considered an application logic error, and can happen for a few reasons:
A parent reducer removed an element with this ID before this reducer ran. This reducer must run before any other reducer removes an element, which ensures that element reducers can handle their actions while their state is still available.
An in-flight effect emitted this action when state contained no element at this ID. While it may be perfectly reasonable to ignore this action, consider canceling the associated effect before an element is removed, especially if it is a long-living effect.
This action was sent to the store while its state contained no element at this ID. To fix this make sure that actions for this reducer can only be sent from a store when its state contains an element at this id. In SwiftUI applications, use "NavigationStack.init(path:)" with a binding to a store.
확인해 보니 pop시 Binding의 set 이 호출되서
이미 path에 없는 element를 호출하게 되서
해당 에러가 발생한다고 합니다.
그럼 TCA 환경에서는 1번을 꼭 사용해야 하는 건지요 ?
回答 1
0
forEach 스코프 구조에서는 스택 요소를 id로 관리합니다
2번같은 수동바인딩을 사용할시 스택의 id 가 바뀌거나 할 경우 id 불일치로 오류가 발생할수있습니다
1번같은 tca 바인딩을 사용하면 tca 내부에서 동적으로 관리된다 합니다.
꼭 tca 바인딩을 쓰지않아도 정상 동작하는 경우가 있으나 일부 저런 오류가 나타날수 있습니다
수강 기간 연장 문의
0
24
1
수강연장부탁드려도될까요..
0
39
2
Combine Playground 에서 실행 시
0
53
2
70강 - 글로벌 액터로 격리된 Protocol 을 extension 에서 conform 시 타입 본체의 격리 수준 질문
0
41
1
searchable이 화면 하단에 위치해요
0
60
2
Drawing Cycle 관련 질문
0
72
1
앱 제작 시 주로 코드로 작성하시는 이유가 있을까요?
0
94
2
델리게이트 패턴 관련 질문
0
66
2
ios 애드몹 광고
0
125
2
수강 기간 연장 부탁드릴 수 있을까요?
0
60
1
활용 앱 57강 질문입니다.
0
54
1
그래프 그리기 위한 API가 프리미엄 요금제를 구독해야만 가능하다고 합니다...ㅜㅜ
0
75
2
과거 ai없을때 듣고 다시 듣는 중인데
1
54
1
활용 앱 30강 에러 질문입니다
0
63
2
예제 빌드시 The compiler is unable to type-check this expression in reasonable time 에러 발생
0
53
1
xcode 26.2 에서 ReducerOf<Self> 이슈
0
76
2
20강 Task 내부에서 nonisolated async 호출 예제 질문드립니다
0
76
2
19강 Actor 의 동작 관련해 질문드립니다
0
82
2
기초앱 17강 Contraints 설정 질문입니다.
0
67
2
소리가 ㅠㅠ
0
53
2
실로폰 음원 재생 오류 해결 (do.1.wav)
1
71
2
Emulate Device Frame 관련 질문입니다.
0
87
2
해당 강의에서 나오는 노션 링크는 따로 제공안되나요 ?
0
78
2
해당 강의는 추가 오픈하는건가요?
0
96
2

