Mac 动态库加载不上

OC xcode 

 can't found xxx.dylib

1 targer- build phase :link binary with library添加动态库

注意不要将后边的选项选成optional ,那样虽然能编译运行,但是实际上并没有加载上,用不了

2 注意此时该页面(build phase )左上角有一个加号,点击会出现copy file 

destination:选择 executable

运行一下还是不行

记住在下边添加上动态库,至于SUBPATH就不要添加了,以免出现只能运行一次的悲哀

3

 copy only when install 也不要选,避免 image not found崩溃

4  buildsetting --- library search pach,runpath search path记得选上,否则可能加载不上动态库

原文地址:https://www.cnblogs.com/8335IT/p/8444359.html