前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >The 'Pods-App' target has transitive dependencies that include static binaries报错

The 'Pods-App' target has transitive dependencies that include static binaries报错

原创
作者头像
莫空9081
发布2022-06-13 09:16:02
6500
发布2022-06-13 09:16:02
举报
文章被收录于专栏:iOS 备忘录iOS 备忘录

The 'Pods-App' target has transitive dependencies that include static binaries:修改

背景

最近遇到了两次次这个问题,都是Swift项目Pod添加库开启了use_frameworks!,安装某些OC库时报错;花了好久时间解决,突然想起来之前OC项目安装Swift库也遇到了这个问题,但是之前没有记录,所以这次遇到时没有印象;这次记录下来,分享给大家:

<!--more-->

解决方案

之前遇到的是OC代码安装ZLPhotoBrowser的Swift库,开启了use_frameworks!,和其他第三方库一起安装时,可以理解为,除了ZLPhotoBrowser是动态库,其他的第三方库默认都使用static_framework或者static_library

Pod文件末尾添加下面代码:

代码语言:Ruby
复制
use_frameworks!

...

dynamic_frameworks = ['ZLPhotoBrowser']
pre_install do |installer|
  installer.pod_targets.each do |pod|
    if !dynamic_frameworks.include?(pod.name)
      def pod.static_framework?;
        true
      end
      def pod.build_type;
        Pod::BuildType.static_library
      end
    end
  end
end

这次是Swift代码安装Pod库,同样开启了use_frameworks!,但是这里想要的是除了某些库使用static_framework或者static_library,其他库都默认使用use_frameworks!

所以Pod文件末尾添加的代码如下:

代码语言:Ruby
复制
use_frameworks!

...

# 要使用OC的第三方库
static_frameworks = ['xxx', 'yyy']
pre_install do |installer|
  installer.pod_targets.each do |pod|
    # 注意这里和上面的不同
    if static_frameworks.include?(pod.name)
      def pod.static_framework?;
        true
      end
      def pod.build_type;
        Pod::BuildType.static_library
      end
    end
  end
end

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • The 'Pods-App' target has transitive dependencies that include static binaries:修改
    • 背景
      • 解决方案
      领券
      问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档