티스토리 뷰
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 알고리즘
- ios
- swift programmers
- removeLast()
- swift (programmers)
- Combine: Asynchronous Programming with Swift
- RTCCameraVideoCapturer
- swift property
- Swift RIBs
- Swift
- RIBs tutorial
- swift 고차함수
- Swift init
- Swift joined
- CS 네트워크
- Swift Error Handling
- 원티드 프리온보딩
- Swift joined()
- iOS error
- Swift 프로그래머스
- Swift 프로퍼티
- Swift 내림차순
- 2023년 회고
- Swift final
- Class
- swift reduce
- Swift inout
- Swift Leetcode
- swift protocol
- Swift ModernRIBs
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 | 31 |
글 보관함