iOS-解决can't locate file for .a文件异常

XCode中,如果直接将LibKeyboardService.a文件拖进到项目中,有时会出现异常。

1
2
3
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: -dynamic not specified the following flags are invalid: -ObjC
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't locate file for: -lKeyboardService
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: -lKeyboardService is not an object file (not allowed in a library)

解决办法是在Build Settings面板下,Library Search Paths中增加多一项,为LibKeyboardService.a所在的目录,注意设置为相对目录,否则提交后,项目其他同事可能编译不过。

YI wechat
欢迎您扫一扫上面的微信公众号,订阅我的博客!