dyld: Library not loaded:解决办法

简介: dyld: Library not loaded:解决办法
dyld: Library not loaded: @rpath/CGModule.framework/CGModule
 Referenced from: /private/var/containers/Bundle/Application/C637342C-51BE-4A0D-BA94-9681629BFC27/iOSTest.app/iOSTest
 Reason: image not found
Message from debugger: Terminated due to signal 6

这个报错解决方式有两种

1.

image.png

WeChat7bc3d602a1cfef2d63a5e29394fb222d.png


在此处改成Optional

2.在Enbedded Binaries添加上.framework

后续

在项目里把.framework 的Status设置成Optional之后,我发现.framework运行时出现问题,并没有如期工作

后经查阅资料,把.framework的Status改成Required


image.png

WeChat97aec0712e84bc250b557e6cd52ad881.png

续上

如上配置之后,发现上传至appStore发生错误,报错如下

image.png

144581571219638_.pic.jpg

解决方案
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
# This script loops through the frameworks embedded in the application and
# removes unused architectures.
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"
EXTRACTED_ARCHS=()
for ARCH in $ARCHS
do
echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
done
echo "Merging extracted architectures: ${ARCHS}"
lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"
rm "${EXTRACTED_ARCHS[@]}"
echo "Replacing original executable with thinned version"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"
done

此段js功能在于剥夺framework中的架构

添加后,报错消失。

相关文章
|
6月前
|
测试技术 iOS开发 Perl
废弃第三方库导致的library not found for -lXXXXX(linker command failed ) 完美解决方法
废弃第三方库导致的library not found for -lXXXXX(linker command failed ) 完美解决方法
95 0
|
11月前
|
Ubuntu Linux 编译器
如何解决使用libevent时的共享库加载问题“error while loading shared libraries: libevent-2.1.so.7: cannot open ...“
如何解决使用libevent时的共享库加载问题“error while loading shared libraries: libevent-2.1.so.7: cannot open ...“
341 0
|
Linux
linux运行protoc出现错误 while loading shared libraries: libprotoc.so.19
linux运行protoc出现错误 while loading shared libraries: libprotoc.so.19
136 0
dyld Library not loaded Reason image not found 问题解决
添加第三方框架,然后启动app的时候会,提示dyld: Library not loaded: Reason: image not found 网上大部分的做法都是把Build Phases 里对应framework后边的选项修改成为Optional,但这个是治标不治本,还是没法解决问题
207 0
codeblocks中出现#error This file requires compiler and library support for the错误时的解决方案
codeblocks中出现#error This file requires compiler and library support for the错误时的解决方案
699 0
codeblocks中出现#error This file requires compiler and library support for the错误时的解决方案
如何解决:./real.exe: error while loading shared libraries: libhdf5hl_fortran.so.100: cannot open shared
如何解决:./real.exe: error while loading shared libraries: libhdf5hl_fortran.so.100: cannot open shared
如何解决:./real.exe: error while loading shared libraries: libhdf5hl_fortran.so.100: cannot open shared
解决办法:GTK+ 2.x symbols detected
解决办法:GTK+ 2.x symbols detected
349 0
错误解决:当前目录下有so,提示 error while loading shared libraries
错误解决:当前目录下有so,提示 error while loading shared libraries
93 0
|
Linux
Linux操作系统下proj4库编译与安装及ERROR 6: Unable to load PROJ.4 library (libproj.so)问题解决
Linux操作系统下proj4库编译与安装及ERROR 6: Unable to load PROJ.4 library (libproj.so)问题解决
896 0