Objective-C로 개발한 프로젝트에서 Swift라이브러리를 쓰다 보면 이런 에러를 만날때가 있다.

Linker error:
ld: warning: Could not find auto-linked library 'swiftFoundation'
ld: warning: Could not find auto-linked library 'swiftDarwin'
ld: warning: Could not find auto-linked library 'swiftCoreFoundation'
ld: warning: Could not find auto-linked library 'swiftCore'
ld: warning: Could not find auto-linked library 'swiftCoreGraphics'
ld: warning: Could not find auto-linked library 'swiftObjectiveC'
ld: warning: Could not find auto-linked library 'swiftDispatch'
ld: warning: Could not find auto-linked library 'swiftSwiftOnoneSupport'
Undefined symbols for architecture arm64:

뭐 이유는 스위프트 라이브러리를 자동으로 링크할 수 없다는 뜻이겠지만, 원인은 Objective-C와 Swift간 브릿지가 없어서 발생된다.

복잡한 해결 방법이 있지만 가장 쉽게 해결하는 방법은
프로젝트에 빈 Swift 파일을 하나 만들어 추가해주면 된다. 생성할때 브릿지 헤더를 생성할거냐고 물어볼때 생성하겠다고 해줘야 한다.

+ Recent posts