首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >安装没有子依赖项的Cocoa Pod依赖项

安装没有子依赖项的Cocoa Pod依赖项
EN

Stack Overflow用户
提问于 2020-09-24 20:08:13
回答 1查看 56关注 0票数 1
代码语言:javascript
复制
pod 'RxGoogleMaps'

我正在尝试安装上面的库,而不安装它的子规范s.dependency 'GoogleMaps', '~> 3'

这是因为由于我们架构的本质(iOS模块化架构),我必须手动链接GoogleMaps (因为它是一个静态库)。

现在,当我尝试安装RxGoogleMaps时,CocoaPods尝试将GoogleMaps作为子依赖项安装,但得到一个错误,因为它已经存在并链接。

有没有办法阻止这个子依赖项的安装?

EN

回答 1

Stack Overflow用户

发布于 2020-09-25 05:59:37

您无法真正避免它被下载,但是您可以将它从xcconfig文件中删除,通过向Podfile添加安装后脚本来避免它被链接

如下所示:

代码语言:javascript
复制
require 'fileutils'

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            if config.base_configuration_reference
                xcconfig_path = config.base_configuration_reference.real_path
                xcconfig = File.read(xcconfig_path)
                new_xcconfig = xcconfig.sub("-framework \"GoogleMaps\"", "")
                File.open(xcconfig_path, "w") { |file| file << new_xcconfig }
            end
        end
    end
end
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64046118

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档