티스토리 뷰
iOS/Error
[iOS Error] Terminating app due to uncaught exception 'NSInternalInconsistencyException'
Peppo 2021. 10. 17. 17:12728x90
문제
카메라 기능 작업중, 사용자가 카메라 접근권한을 허용하지 않을시 alert창을 띄워져야하는데
콘솔에 아래와 같은 에러가 뜨면서 앱이 꺼져버렸다.
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread.'
에러내용을 보면 layout 엔진은 main thread에서 접근이 되었다면 background thread에서 수행되어서는 안된다.
위 내용을 바탕으로 에러가 났던 부분을 DispatchQueue.main.async로 감싸주었더니 고쳐졌다.
DispatchQueue.main.async{
// code
}
728x90
'iOS > Error' 카테고리의 다른 글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- swift 고차함수
- Swift joined
- Swift ModernRIBs
- swift (programmers)
- Swift Leetcode
- 2023년 회고
- Swift joined()
- Class
- Swift Error Handling
- Swift 프로그래머스
- Swift 내림차순
- Swift init
- CS 네트워크
- swift protocol
- swift reduce
- Swift
- ios
- Combine: Asynchronous Programming with Swift
- Swift final
- swift programmers
- iOS error
- removeLast()
- swift property
- Swift RIBs
- Swift 프로퍼티
- 원티드 프리온보딩
- RIBs tutorial
- RTCCameraVideoCapturer
- Swift inout
- Swift 알고리즘
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 |
글 보관함