Xcode14编译iOS11或iOS12报错dyld: Library not loaded: /usr/lib/swift/libswiftCoreGraphics.dylib 解决方案

在更新Xcode14之后发现编译项目在iOS12.5以上的系统都正常,但是在跑iOS12.5以下的系统,例如iOS11,和iOS12.1之类的系统会报错,报错如下:

dyld: Library not loaded: /usr/lib/swift/libswiftCoreGraphics.dylib
Referenced from: /private/var/containers/Bundle/Application/xxx-xxx-xxx-xxx-xxxx/xxx.app/Frameworks/xxx.framework/xxx
Reason: image not found

一看原因发现为image not found,但是项目中也没有用到这个库的image,而且在iOS12.5以上跑没有问题,所以显然不是这个问题,那么应该就是这个Library not loaded的问题。那么该问题的解决方案就是缺少那个library就在哪个库的 Targets-> Build Phase -> Link Binary with Libraries 中添加这个 libswiftCoreGraphics好了(报错是哪个库就加哪个)。例如我是缺少libswiftCoreGraphics,所以加一个libswiftCoreGraphics.tbd 就可以了;

注意还有一个前提:

那就是主工程中:Targets -> Build Settings ->Build Options -> Always Embed Swift Standard Libraries 需要设置为 Yes
————————————————
版权声明:本文为CSDN博主「星光uoin」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_37269542/article/details/127064291

posted @ 2022-10-17 09:54  brave-sailor  阅读(181)  评论(0编辑  收藏  举报