iOS解决“The ‘Pods-XXX‘ target has transitive dependencies that include statically linked binaries”报错

  • Post author:
  • Post category:其他


Objective-C项目中的podfile引入了swift库后编译时报了下面的错误:

Undefined symbol: static Swift.String.+ infix(Swift.String, Swift.String) -> Swift.String


解决方案:

在podfile引入的swift库之前加入use_frameworks!

use_frameworks!
pod 'XXXX'

再次执行pod install之后又报了下面的错误:

The ‘Pods-XXX‘ target has transitive dependencies that include statically linked binaries:
(/Users/XXXX/XXXX/XXXX/XXXX.framework)


解决方案:

在podfile中加入下面的代码:

pre_install do |installer|
  # workaround for https://github.com/CocoaPods/CocoaPods/issues/3289
  Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
end

再次执行pod install之后成功。

引用swift库时需要把#import改为@import

@import XXXX;



版权声明:本文为watson2017原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。