导入动态库以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.
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
网友评论