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

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|
Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
end

再次执行pod install之后成功。

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

@import XXXX;

你可能感兴趣的:(iOS解决“The ‘Pods-XXX‘ target has transitive dependencies that include statically linked binaries”报错)