iOS Dynamic Library&Static Libraries

Framework Programming Guide

框架(静态库动态库)都具有相同的用途,优点:

  • 资源放在一起的同时却又分组,即可以更轻松地安装,卸载和定位这些资源

  • 框架可以包括比库更多种资源类型。例如,框架可以包含任何相关的头文件和文档。

  • 框架的多个版本可以包含在同一个包中。这使得可以向后兼容旧程序。

  • 无论有多少进程正在使用这些资源,在任何给定时间,只有一个框架的只读资源副本驻留在内存中。这种资源共享减少了系统的内存占用,有助于提高性能

动态库

Dynamic Library Programming Topics
程序中,我们的自定义代码与系统的库链接起来以获得基本功能,如果我们此时要实现一个复杂的功能,程序中直接链接到库会创建大量可执行文件并浪费内存。而动态库可以在应用程序启动时或运行时加载,所以很方便的:

  • 减少了应用程序的文件大小和内存占用量
  • 减少了应用程序启动时加载的代码量

当应用程序启动时,应用程序的代码(包括与之链接的静态库的代码)被加载到应用程序的地址空间中,将许多静态库链接到应用程序会生成大型应用程序可执行文件,如图:

App using static libraries.png
  • 具有大型可执行文件的应用程序具有较慢的启动时间和较大的内存占用
  • 当更新静态库时,其客户端应用程序不会受益于对其所做的改进。
  • 要访问改进的功能,应用程序的开发人员必须将应用程序的目标文件与新版本的库链接起来(应用程序用户必须使用最新版本替换他们的应用程序副本)

更好的方法是:让应用程序在实际需要时将代码加载到其地址空间中,无论是在启动时还是在运行时。 提供这种灵活性的库类型称为动态库。 动态库不会静态链接到客户端应用程序; 它们不会成为可执行文件的一部分。 相反,可以在启动应用程序或运行应用程序时将动态库加载(和链接)到应用程序中。如图:

App using dynamic libraries.png

跑个demo??原创在此,以下所有的步骤几乎都是参照该博客的

新建工程


image.png
image.png

配置Xcode


image.png
image.png
image.png
image.png

公开的头文件设置


image.png

资源包


image.png

资源包配置


image.png
image.png

资源包编译


image.png

资源包引入


image.png
image.png
image.png
image.png

image.png

image.png
if [ "${ACTION}" = "build" ]
then
INSTALL_DIR=${SRCROOT}/Products/${PROJECT_NAME}.framework

DEVICE_DIR=${BUILD_ROOT}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework

SIMULATOR_DIR=${BUILD_ROOT}/${CONFIGURATION}-iphonesimulator/${PROJECT_NAME}.framework


if [ -d "${INSTALL_DIR}" ]
then
rm -rf "${INSTALL_DIR}"
fi

mkdir -p "${INSTALL_DIR}"

cp -R "${DEVICE_DIR}/" "${INSTALL_DIR}/"
#ditto "${DEVICE_DIR}/Headers" "${INSTALL_DIR}/Headers"

lipo -create "${DEVICE_DIR}/${PROJECT_NAME}" "${SIMULATOR_DIR}/${PROJECT_NAME}" -output "${INSTALL_DIR}/${PROJECT_NAME}"

#open "${DEVICE_DIR}"
#open "${SRCROOT}/Products"
fi

error: /Users/samtake/Library/Developer/Xcode/DerivedData/DynamicLibraryDemo-frkfwimqnnrooccpcmrtxdebahpo/Build/Intermediates.noindex/ArchiveIntermediates/DynamicLibraryDemo/BuildProductsPath/Release-iphoneos/DynamicLibraryBundle.bundle: No such file or directory

出现这个错误,我的解决办法是


image.png

重新编译完成。

合并SDK的时候报错了

fatal error: lipo: can't open input file: /Users/samtake/Library/Developer/Xcode/DerivedData/DynamicLibraryDemo-frkfwimqnnrooccpcmrtxdebahpo/Build/Products/Debug-iphonesimulator/DynamicLibraryDemo.framework/DynamicLibraryDemo (No such file or directory)
Command PhaseScriptExecution failed with a nonzero exit code

先新建一个工程测试下SDK效果吧。。。

真机和模拟器,调试均报错

ld: '/Users/samtake/Documents/DynamicLibraryDemoTest/DynamicLibraryDemoTest/DynamicLibraryDemo.framework/DynamicLibraryDemo' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. file '/Users/samtake/Documents/DynamicLibraryDemoTest/DynamicLibraryDemoTest/DynamicLibraryDemo.framework/DynamicLibraryDemo' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
image.png

加载成功之后,调用SDK报错

objc[3314]: Class SDImageCodersManager is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f5f50) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a68a0). One of the two will be used. Which one is undefined.
objc[3314]: Class SDWebImageManager is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f5d20) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a68f0). One of the two will be used. Which one is undefined.
objc[3314]: Class SDWebImageCombinedOperation is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f5d48) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a6918). One of the two will be used. Which one is undefined.
objc[3314]: Class SDImageAssetManager is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f6770) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a6990). One of the two will be used. Which one is undefined.
objc[3314]: Class SDAPNGCoderFrame is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f65b8) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a6a08). One of the two will be used. Which one is undefined.
objc[3314]: Class SDImageAPNGCoder is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f65e0) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a6a30). One of the two will be used. Which one is undefined.
objc[3314]: Class SDImageCachesManagerOperation is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f6400) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a6a80). One of the two will be used. Which one is undefined.
objc[3314]: Class SDImageCache is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f6310) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a6ad0). One of the two will be used. Which one is undefined.
objc[3314]: Class SDAnimatedImage is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f5ff0) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a6b20). One of the two will be used. Which one is undefined.
objc[3314]: Class SDWebImagePrefetcher is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f64a0) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a6b70). One of the two will be used. Which one is undefined.
objc[3314]: Class SDWebImagePrefetchToken is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f64c8) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a6b98). One of the two will be used. Which one is undefined.
objc[3314]: Class SDImagePipelineTransformer is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f5a50) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a6c10). One of the two will be used. Which one is undefined.
objc[3314]: Class SDImageRoundCornerTransformer is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f5aa0) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a6c60). One of the two will be used. Which one is undefined.
objc[3314]: Class SDImageResizingTransformer is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f5af0) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a6cb0). One of the two will be used. Which one is undefined.
objc[3314]: Class SDImageCroppingTransformer is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f5b40) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a6d00). One of the two will be used. Which one is undefined.
objc[3314]: Class SDImageFlippingTransformer is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f5b90) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a6d50). One of the two will be used. Which one is undefined.
objc[3314]: Class SDImageRotationTransformer is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f5be0) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a6da0). One of the two will be used. Which one is undefined.
objc[3314]: Class SDImageTintTransformer is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f5c30) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a6df0). One of the two will be used. Which one is undefined.
objc[3314]: Class SDImageBlurTransformer is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f5c80) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a6e40). One of the two will be used. Which one is undefined.
objc[3314]: Class SDImageFilterTransformer is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f5cd0) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a6e90). One of the two will be used. Which one is undefined.
objc[3314]: Class SDWebImageActivityIndicator is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f5e10) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a6ee0). One of the two will be used. Which one is undefined.
objc[3314]: Class SDWebImageProgressIndicator is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f5e60) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a6f30). One of the two will be used. Which one is undefined.
objc[3314]: Class SDWebImageCacheKeyFilter is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f63b0) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a6fd0). One of the two will be used. Which one is undefined.
objc[3314]: Class SDWebImageDownloaderOperation is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f6130) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a7020). One of the two will be used. Which one is undefined.
objc[3314]: Class SDMemoryCache is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f61d0) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a7070). One of the two will be used. Which one is undefined.
objc[3314]: Class SDWebImageOptionsResult is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f6270) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a70c0). One of the two will be used. Which one is undefined.
objc[3314]: Class SDWebImageOptionsProcessor is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f62c0) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a7110). One of the two will be used. Which one is undefined.
objc[3314]: Class SDImageCachesManager is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f6220) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a7160). One of the two will be used. Which one is undefined.
objc[3314]: Class SDWebImageTransition is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f5f00) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a71b0). One of the two will be used. Which one is undefined.
objc[3314]: Class SDWeakProxy is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f6360) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a7200). One of the two will be used. Which one is undefined.
objc[3314]: Class SDWebImageDownloader is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f6090) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a7250). One of the two will be used. Which one is undefined.
objc[3314]: Class SDWebImageDownloadToken is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f60b8) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a7278). One of the two will be used. Which one is undefined.
objc[3314]: Class SDImageCoderHelper is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f6568) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a7318). One of the two will be used. Which one is undefined.
objc[3314]: Class SDImageFrame is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f59b0) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a7340). One of the two will be used. Which one is undefined.
objc[3314]: Class SDGIFCoderFrame is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f66a8) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a73b8). One of the two will be used. Which one is undefined.
objc[3314]: Class SDImageGIFCoder is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f66d0) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a73e0). One of the two will be used. Which one is undefined.
objc[3314]: Class SDImageLoadersManager is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f6630) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a7430). One of the two will be used. Which one is undefined.
objc[3314]: Class SDWebImageCacheSerializer is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f6450) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a7480). One of the two will be used. Which one is undefined.
objc[3314]: Class SDWebImageDownloaderRequestModifier is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f6720) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a7520). One of the two will be used. Which one is undefined.
objc[3314]: Class SDWebImageDownloaderConfig is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f5eb0) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a7570). One of the two will be used. Which one is undefined.
objc[3314]: Class SDAnimatedImageView is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f6180) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a75c0). One of the two will be used. Which one is undefined.
objc[3314]: Class SDImageIOCoder is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f5960) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a7610). One of the two will be used. Which one is undefined.
objc[3314]: Class SDDiskCache is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f5fa0) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a7660). One of the two will be used. Which one is undefined.
objc[3314]: Class SDAsyncBlockOperation is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f5a00) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a76b0). One of the two will be used. Which one is undefined.
objc[3314]: Class SDImageCacheConfig is implemented in both /private/var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/Frameworks/DynamicLibraryDemo.framework/DynamicLibraryDemo (0x1005f5dc0) and /var/containers/Bundle/Application/8DED749D-23B7-430A-BA6A-F625DA04894B/DynamicLibraryDemoTest.app/DynamicLibraryDemoTest (0x1001a7700). One of the two will be used. Which one is undefined.

SDK需要用到的第三方库,主项目中也用到同样的第三方库,报错了。。。。解决:目前想到的就是将主项目的第三方库去掉,从库里面引出头文件供主项目使用。。

重新编译报错

2019-07-21 02:52:41.485994+0800 DynamicLibraryDemoTest[3322:645253] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSBundle initWithURL:]: nil URL argument'
*** First throw call stack:
(0x1c4ef927c 0x1c40d39f8 0x1c4e034b0 0x1c5894bd4 0x1c5894b58 0x1014d4910 0x10115a758 0x1f16bd040 0x1f11661c8 0x1f11664e8 0x1f1165554 0x1f16f4304 0x1f16f552c 0x1f16d559c 0x1f179b714 0x1f179de40 0x1f1797070 0x1c4e8b018 0x1c4e8af98 0x1c4e8a880 0x1c4e857bc 0x1c4e850b0 0x1c708579c 0x1f16bb978 0x10115a894 0x1c494a8e0)
libc++abi.dylib: terminating with uncaught exception of type NSException

未完,,后续补上。。

你可能感兴趣的:(iOS Dynamic Library&Static Libraries)