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月前
|
机器学习/深度学习 算法 算法框架/工具
Library
Library
37 1
|
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 ...“
338 0
|
12月前
|
Linux
linux运行protoc出现错误 while loading shared libraries: libprotoc.so.19
linux运行protoc出现错误 while loading shared libraries: libprotoc.so.19
132 0
如何解决:./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
348 0
错误解决:当前目录下有so,提示 error while loading shared libraries
错误解决:当前目录下有so,提示 error while loading shared libraries
91 0
Xcode12.x报错: ld: library not found for -lstdc++.6.0.9
错误信息: ld: library not found for -lstdc++.6.0.9 报错原因:Xcode10移除了动态库libstdc
274 0
成功解决OSError: dlopen() failed to load a library: cairo / cairo-2 / cairo-gobject-2 / cairo.so.2
成功解决OSError: dlopen() failed to load a library: cairo / cairo-2 / cairo-gobject-2 / cairo.so.2
成功解决OSError: dlopen() failed to load a library: cairo / cairo-2 / cairo-gobject-2 / cairo.so.2