cocoapods - 如何在 CocoaPods post_install 挂钩中删除方案
问题描述
如何在post_install
钩子中删除 CocoaPods 创建的方案?这有点令人费解,但这个方案正在破坏 Carthage为我的 SwiftMessages 库构建的版本。
根据这个线程,删除方案是可能的。但是,我查看了CocoaPods 参考资料,但没有找到办法。
更新
按照 Thiago Cruz 的建议,我在我的项目中添加了以下安装后挂钩。保持简单,我只是在 pods 项目中删除了所有用户和共享数据。
post_install do |installer|
# Blow away schemes – the schemes created by CocoaPods break Carthage builds
# because they incluede a SwiftMessages framework that Carthage picks
# over the main SwiftMessages framework. The SwiftMessages framework that gets
# picked is configured for an app extension and doesn't work correctly in an app.
File.directory?(path)
[
"#{installer.sandbox.root}/Pods.xcodeproj/xcuserdata",
"#{installer.sandbox.root}/Pods.xcodeproj/xcshareddata"
].each { |path|
if File.directory?(path)
FileUtils.remove_dir(path)
end
}
end
除此之外,我必须打开 pods 项目并在方案管理对话框中禁用“自动创建方案”。值得注意的是,pod install
不会还原此设置。
解决方案
不确定.xcscheme
要删除哪些文件,但在post_install
挂钩中,您可以访问项目的根目录以及/Pods
根目录。您可以glob
访问该文件并手动删除它。
post_install do |installer|
puts "#{installer.config.installation_root}"
puts "#{installer.sandbox.root}"
end
推荐阅读
- opencv - MFC CDC 创建的 PDC 变量无法读取内存
- vue.js - Vue(Vuetify)中的 V-img 未在浏览器上下文菜单中实现为图像
- bootstrap-4 - Bootstrap h-100 应用于或标记?
- laravel-livewire - 调用 livewire 操作时,CPanel 站点发生错误
- javascript - DataTables 中的复选框需要捕获所有选中的值
- javascript - 将具有不同键的对象数组格式化为表数据
- npm - 如何正确搭建一个新的 Docusaurus 网站?
- python - 日期过滤器在 Django 中失败
- datagridview - 如何解决解析查询的问题?
- json - 斯威夫特,JSON 模型