swift/swift 에러

[Xcode Error] failed to read asset tags / 이미지 에셋 한글 에러

isak(이삭) 2024. 6. 3. 15:06

사용환경

macOS sonoma 14.0
xcode 15.3
device mac mini m2pro
macbook pro m2 13"

 

Error message:

 

failed to read asset tags: The command '(cd/Users/___ /Documents/GitHub/_____ /_____ && /Applications/Xcode.app/Contents/Developer/usr/binactool --print-asset-tag-combinations --output-formal xml1 /Users/____ /Documents/GitHub/_____/_____/_____/Assets.xcassets)' exited with status 255.

 

// 문제 생긴 파일 관련한 에러 메세지 출력

 

에러를 겪은 상황

main에서 뻣어나온 브랜치 refactor/#31에서 기능 추가를 위해 feat/#32 브랜치를 생성하여 기능을 추가했다.

관련 기능에 한글이 파일명인 이미지 파일을 추가하였다.

 

작업이 완료되고, #31 <- #32 로 pr&merge 후 브랜치 #31이 잘 돌아가는지 확인해보려는데

 

? 강제종료 .

 

< 아래의 해결방법을 통해 해결 >

 

main <- #31 로 pr&merge 했을 때, ? 강제종료 .

 

 

해결 방법

1. 문제 생긴 asset 파일들 asset에서 삭제

( * xcode에서 에셋만 누르면 강제종료 되어서, project/project/Assets.xcassets 에서 직접 삭제함 )

2. asset 파일 추가

3. build 

 

빌드 성공

 

에러 발생 원인

asset에 넣은 이미지 파일명이 한글이름이었고, 파일명이 UTF-8로 인코딩되지 않으면 문제가 발생할 수 있음.

그래서 refactor/#{issueNum} <- feat/#{issueNum} 로 머지 될 때, 프로젝트 파일만 열면 강제종료 되는 에러가 발생했음.

 

그럼 결국 main <- refactor/#{issueNum} 일 때도 같은 문제가 발생되겠다. 생각했는데,

 

yes.

 

다음부턴 asset 파일이름을 영어로 넣어서 한글 인코딩으로 인한 강제종료 에러를 방지하거나, .gitattributes 파일에 바이너리 파일 설정을 추가해서 인코딩 문제를 방지하면 될 것 같다. 

// .gitattributes 파일에 이렇게 설정

* text=auto eol=lf
*.m     text diff=objc
*.h     text diff=objc
*.swift text diff=swift
*.png   binary
*.jpg   binary
*.jpeg  binary
*.gif   binary
*.pdf   binary
*.xcassets  binary

 

그치만 ^_^.. 한글 네이밍은 피하겠다 !