Xcode导出本地化会引发错误“参数列表过长”; [英] Xcode export localization throws error "Argument list too long"

查看:97
本文介绍了Xcode导出本地化会引发错误“参数列表过长”;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于Xcode本地化过程,我遇到了一个非常奇怪的错误。我将尽力在法律上分享尽可能多的细节。

I've got a very curious error to share regarding Xcode localization process. I will try to share as much detail as legally possible.

我试图从Xcode导出XLIFF文件,以通过编辑器>导出本地化发送给我们的翻译人员。但是,此消息立即引发错误:

From Xcode, I am trying to export an XLIFF file to send to our translators, via "Editor > Export for Localizations". However, this immediately throws error with the message:

The operation couldn't be completed. Argument list too long

这的确令人困惑,因为我无法在任何地方找到更详细的日志(我有已经尝试检查我的Console.app)。因此,我花了很多时间进行谷歌搜索-无济于事。我找不到类似的情况。仅当我尝试导出以进行本地化时,错误本身才会发生。我可以很好地构建和运行该应用程序。

This is indeed confusing, as I cannot find a more verbose log anywhere (I have already tried checking my Console.app). So, I spent quite a few time googling – to no avail. I couldn't find similar case like this. The error itself happens only when I am trying to export for localization. I can build and run the app just fine.

~ $ xcodebuild -version
Xcode 8.2
Build version 8C38
~ $ xcode-select -version
xcode-select version 2347.
~ $ echo $PATH
/Users/david.christiandy/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/david.christiandy/arctools/arcanist/bin:/usr/local/go/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands




  1. 我在macOS Sierra 10.12.5上使用Xcode 8.2。

  2. 仅当我尝试从本地化导出时才会发生错误。当我通过 xcodebuild -exportLocalizations 运行本地化过程时,也是如此。

  3. 我可以很好地构建和运行该应用程序。 (我相信)我的标题搜索路径没有问题。

  1. I am using Xcode 8.2 on macOS Sierra 10.12.5.
  2. The error happens only when I try exporting from localization. This is also true when I run the localization process via xcodebuild -exportLocalizations.
  3. I can build and run the app just fine. (I believe) there's no problem with my header search paths.



尝试




  • 代码中有问题,因此我尝试在CI中运行导出过程(通过 xcodebuild 命令)。以某种方式,它正在工作。作为记录,我使用的Bitrise CI具有与系统相同的堆栈(Xcode 8.2.x,macOS 10.12)

  • 请同事在其计算机上运行导出过程,并且他们相同的错误。

  • 这使我认为配置一定有问题。因此,我做了一个独立的项目,以确认导出过程始终失败。原来,它工作得很好!

  • Attempts

    • Thought there was something wrong in the code, so I tried to run the export process (via xcodebuild command) in a CI. Somehow, it's working. For the record, I am using Bitrise CI with the same stack as my system (Xcode 8.2.x, macOS 10.12)
    • Asked colleagues to run export process on their machines, and they have the same error.
    • This leads me to think that there must be something wrong with the configuration. So I made a standalone project to confirm that the export process fails consistently. Turns out, it works just fine!

      • 代码中可能存在错误,并且

      • 可能有一些工具/软件(大多数iOS工程师已安装)错误(由于配置项正常完成)。

      我不知道配置项为何可以正常运行导出过程,我不知道它何时可能突然停止运行(就像我们的本地计算机一样)。

      I don't know why the CI can run the export process just fine, and I don't know when it might suddenly stop functioning (just like our local machines).

      对此事有任何帮助。谢谢!

      Appreciate any help on this matter. Thank you!

      推荐答案

      我也在Apple开发人员论坛上问了这个问题,这里是链接: https://forums.developer.apple.com/thread/86762

      I also asked this question on Apple developer forums, here is the link: https://forums.developer.apple.com/thread/86762


      参数列表太长听起来像 E2BIG ,当您尝试运行带有大参数的子进程时会遇到此问题列表(我相信当前限制为256 KiB)。我怀疑本地化导出正在运行某种命令行工具来完成这项工作(可能是 extractLocStrings 工具,您会发现它潜伏在在Xcode的应用包中),并将其完整路径传递到项目中的每个文件。取决于您拥有的文件数量和这些路径的长度,很容易会遇到这样的问题。

      "Argument list too long" sounds like E2BIG, which you get when you try to run a child process with a huge argument list (I believe the current limit is 256 KiB). I suspect that Export for Localizations is running some sort of command line tool to do that work (probably the extractLocStrings tool, which you’ll find lurking within Xcode’s app bundle) and passing it full paths to each of the files in your project. Depending on how many files you have and how long those paths are, it’s easy to run into problems like this.

      关于此类bug的有趣事情之一是它们取决于您放置项目的位置。如果项目位于主目录的顶部,则可能会起作用,但如果嵌套在子目录的深处,则失败。
      这也暗示了一种潜在的解决方法,即将您的项目进一步移到目录层次结构中。

      One of the ‘fun’ things about bugs like this is that they are dependent on where you place your project. Things might work if the project is at the top of your home directory but fail if it’s nested deep inside a subdirectory. That also suggests a potential workaround, namely, to move your project further up in the directory hierarchy.

      最后,您绝对应该为此提交一个错误。我相信我们之前已经见过( r。30703294 ),但是您的报告将有助于进一步说明,这给该领域的开发人员带来了麻烦。请张贴您的错误号,仅供参考。

      Finally, you should definitely file a bug about this. I believe we’ve seen this before (r. 30703294) but your report will help reinforce that this is causing problems for developers in the field. Please post your bug number, just for the record.

      几天前,在我阅读此答案之前,我设法使导出工作正常通过Xcode删除一些文件夹(仅删除参考)。最初,我怀疑删除的文件夹中存在无效的格式,但是当我尝试删除其他文件夹时,导出过程可以正常工作。

      Several days ago before I read this answer, I managed to get the export working by deleting some folders via Xcode (remove references only). Initially I suspected that there's an invalid format within the folders that I deleted, but when I tried deleting other folders, the export process works just fine.

      我也尝试导出字符串使用Xcode 9,我没有遇到问题。因此,希望该错误仅适用于Xcode 8.3.3及更低版本。

      I also tried exporting strings using Xcode 9, and I didn't encounter the problem. So hopefully this bug is only for Xcode 8.3.3 and below.

      这篇关于Xcode导出本地化会引发错误“参数列表过长”;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆