iOS 导入动态库

2021-04-22  本文已影响0人  温柔vs先生

导入动态库以build后一直报下面的错误

dyld: Library not loaded: @rpath/FBSDKShareKit.framework/FBSDKShareKit
  Referenced from: /private/var/containers/Bundle/Application/FF9BBD43-54B0-4F55-9BB8-DD095D80E79D/PhotosRepair.app/PhotosRepair
  Reason: image not found
dyld: launch, loading dependent libraries
DYLD_LIBRARY_PATH=/usr/lib/system/introspection
DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib

网上找到一个解决方法 https://www.jianshu.com/p/dd08131c9115 添加以后报下面错误

Building for iOS Simulator, but the linked and embedded framework 'My.framework' was built for iOS + iOS Simulator.

最后在https://stackoverflow.com/questions/65303304/xcode-12-3-building-for-ios-simulator-but-the-linked-and-embedded-framework-wa 中找到方法

Another workaround is to set BuildSettings ->"Validate Workspace" to Yes. It will still show a warning, but will build the project.

可以解决。

后来经过了解才知道,原来在我们导入库文件时,有动态静态之分(动态库只能是framework),如果是动态库,必须采用embed & sign,


image.png

当我们选中后,build phases中会自动添加如下图:


image.png

参考地址:https://juejin.cn/post/6844904013129842695

上一篇下一篇

猜你喜欢

热点阅读