如何使用ibtool生成字符串文件?

时间:2016-03-24 13:22:40

标签: command-line-tool ibtool xcode7.3

我在xcode 7.3中安装了命令行工具,在命令行中我使用以下命令生成字符串文件:

  ibtool --generate-strings-file testFile.strings MyController.xib

并且我也尝试为我的xib提供目录路径:

  ibtool --generate-strings-file testFile.strings UI/Screens/My\ Card/MyController.xib

我也尝试过使用sudo infront的命令,从answer

建议

他们都没有工作。

我收到了错误:

 <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.ibtool.errors</key>
    <array>
        <dict>
            <key>description</key>
            <string>Interface Builder could not open the document MyController.xib" because it does not exist.</string>
        </dict>
    </array>
</dict>
</plist>

1 个答案:

答案 0 :(得分:0)

我使用了错误的xib位置。我通过在xcode中的项目导航中看到它的heirarchy,从而使xib的位置变得渺茫。可以在“源代码管理”选项下的“文件检查器”选项卡中找到正确的路径。

  1. 选择xib文件

  2. 转到“工具”部分的“文件检查器”。

  3. 查看源代码管理选项下的位置路径。它将类似于:

      /Users/VenkataManiteja/Desktop/iOS/MyProject/src/MyController.xib
    
  4. 我将命令更改为

       ibtool --generate-strings-file testFile.strings src/MyController.xib
    

    并且有效。