覆盖 cocoapod 包资源中的字符串文件

Overwrite strings file in cocoapod bundle resource

我正在寻找一种优雅的解决方案来覆盖我的 Pods 资源文件之一(特别是 .bundle 中的 .strings 文件)中的条目,可能涉及 post_install 任务中的某些内容在我的 Podfile 中。

不幸的是,有问题的 Pod 是闭源的(Zendesk SDK) and changing those bundle files manually is their suggested method 自定义字符串。

我的 Pods 文件夹目前处于源代码控制之下,所以我目前不优雅的解决方案是在我的 Podfile 中记录一条警告,以提醒自己在 运行 [=11= 时手动更新该资源].但是,我想从源代码管理中删除我的 Pods 目录,这进一步需要一个解决方案。

任何椰子足类动物 and/or Ruby 伙计们有解决这个愚蠢问题的好方法吗?

使用 [plutil][1] 提出解决方案(因为 .strings 文件实际上是 属性 列表)。

在我的 Podfile:

  post_install do | installer |          
  system("plutil -replace \"MyPropertyListStringKey" \
          -string "My string goes here" \
          Pods/pathto/Localizable.strings")
  end