티스토리 뷰

요즘 위젯쪽을 다루고 있는데 빌드 도중 아래와 같은 오류가 났습니다.

(참고로 개발 환경은 Xcode 14.3 입니다.) 

Terminating app due to uncaught exception 'NSFileHandleOperationException', reason: '*** -[NSConcreteFileHandle fileDescriptor]: No such file or directory'

더보기

2023-04-25 11:21:23.495028+0900 TTestWiddgetExtension[1695:218191] *** Terminating app due to uncaught exception 'NSFileHandleOperationException', reason: '*** -[NSConcreteFileHandle fileDescriptor]: No such file or directory'

*** First throw call stack:

(0x1a47a6d94 0x19d85c3d0 0x19ef53ea8 0x19eb07724 0x1a80d4c30 0x1a80e4104 0x1a8dcec00 0x1a8106d10 0x1a8100f74 0x1a810d540 0x19e860fa8 0x19eb65d98 0x19eb670ec 0x19eb68048 0x19e53fa90 0x19e53346c 0x1a810f6b4 0x1a80f73d4 0x19e860fa8 0x19eb65d98 0x19eb670ec 0x19eb68048 0x19e53fa90 0x19e53346c 0x1a80bb3d0 0x1a817dc50 0x19e860fa8 0x19eb65d98 0x19eb670ec 0x19eb68048 0x19e53fa90 0x19e53346c 0x1a80aee38 0x1a80a76c0 0x19e860fa8 0x19eb65d98 0x19eb684dc 0x19eb693d4 0x19e55463c 0x19e554774 0x19e860fa8 0x19eb65d98 0x19eb670ec 0x19eb68048 0x19e53fa90 0x19e53346c 0x1a80d0834 0x1a80c7bb0 0x19e860fa8 0x19eb65d98 0x19eb670ec 0x19eb68048 0x19e53fa90 0x19e53346c 0x1a80aedf8 0x1a80a76c0 0x19e860fa8 0x19eb65d98 0x19eb684dc 0x19eb693d4 0x19e55463c 0x19e554774 0x19e860fa8 0x19eb65d98 0x19eb670ec 0x19eb68048 0x19e53fa90 0x19e53346c 0x1a80d0834 0x1a80c7bb0 0x19e860fa8 0x19eb65d98 0x19eb670ec 0x19eb68048 0x19e53fa90 0x19e53346c 0x1a80aedf8 0x1a80a76c0 0x19e860fa8 0x19eb65d98 0x19eb684dc 0x19eb693d4 0x19e55463c 0x19e554774 0x19e860fa8 0x19eb65d98 0x19eb670ec 0x19eb68048 0x19e53fa90 0x19e53346c 0x1a80d0834 0x1a80c7bb0 0x19e860fa8 0x19eb65d98 0x19eb670ec 0x19eb68048 0x19e53fa90 0x19e53346c 0x1a81c80a0 0x1a81af550 0x19e860fa8 0x19eb65d98 0x19eb659dc 0x19eb6515c 0x19eb74898 0x1a8108004 0x1a8115fd0 0x1a8cd3eb8 0x1a8cd397c 0x1a8cd42d4 0x1a8cd41a4 0x1a8198b4c 0x1b1aa7f18 0x1b1acba84 0x1b1ad0960 0x1b1b92214 0x1b1aab60c 0x1abc64320 0x1abc65eac 0x1abc746a4 0x1abc742f4 0x1a4835d18 0x1a4817650 0x1a481c4dc 0x19eab20c4 0x19eab1f58 0x204184678 0x204186924 0x19eaf9ac0 0x1b1d9e658 0x1b1d9e4f0 0x1b1dbe520 0x19eb3df80 0x1c3ca4dec)

libc++abi: terminating due to uncaught exception of type NSException

생각보다 해결 방법은 간단합니다. 

저는 위젯에 TimeLine 설정이 꼬이면서 발생했습니다. 

위젯이라면 IntentTimelineProvider를 사용해 업데이트를 하실텐데 

IntentTimelineProvider -> getTimeline 내부에 특정 부분이 두번 호출되서 생긴 문제였습니다.

func getTimeline(for configuration: ConfigurationIntent, in context: Context, completion: @escaping (Timeline<Entry>) -> ()) {
    ....
    completion(timeline)
    ....
    ....
    completion(timeline)
	// 이런식으로 2개가 들어가서 문제가 된거였습니다.
}

그래서 하나를 없애주었더니 잘 돌아가네요. 

 

비슷한 오류를 겪고 계신 분들을 위해 올려봅니다. 

오늘도 파이팅입니다. 

댓글