Error: linker command failed with exit code 1 (use -v to see invocation)

时间:2022-06-08 10:45:46

Error: linker command failed with exit code 1 (use -v to see invocation)

报错:

ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

场景:

用XCode9.1新建一个项目,集成极光推送后,一直报如图错误。

Error: linker command failed with exit code 1 (use -v to see invocation)

解决:

开始以为是不支持arm64,因为输出打印了“ld: symbol(s) not found for architecture arm64”。

使用指令(lipo -info jpush-ios-3.0.7.a)在终端输出( are: armv7 armv7s x86_64 arm64 )发现不是这原因。

以前集成极光推送没遇到过这种问题,感觉有点莫名,各种可能的原因试了都没卵用。最后没办法,下载了一个极光demo,在两个项目玩起了找茬游戏,还是发现了区别。

如图,解决这个报错只需要将添加到左边的依赖库拖到Link Binary With Libraries即可。

测试了下,目前添加库默认并未同时添加进入Link Binary With Libraries,但是选中列表中某对象再添加库就没问题了。

Error: linker command failed with exit code 1 (use -v to see invocation)