5

実行されるビルド スクリプト ステップを追加しました

ibtool ./Mobile/Base.lproj/MainStoryboard_iPad.storyboard --generate-strings-file ./Mobile/Base.lproj/MainStoryboard_iPad.strings

これはビルドに失敗します

<?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 "MainStoryboard_iPad.storyboard" because it does not exist.</string>
    </dict>
</array>
</dict>
</plist>
Command /bin/sh failed with exit code 1

プロジェクトが最初にクリーンアップされてからビルドされると、最初は成功します。

サンプルプロジェクトでこれを複製しようとしましたが、複製できませんでした。私たちの実際のプロジェクトはもっと複雑です... 6 つの言語があり、プロジェクトには 2 つのターゲット (エンタープライズ ビルド用とストア ビルド用) があります。多くのクラスと 2 つの大きなストーリーボード。

ツールのバグであるかどうかを判断するために問題の原因を突き止めるために、別の方法を試してみることを提案する人はいますか?

4

4 に答える 4

4

通常のxibファイルでXcode 5を使用すると、同じ問題が発生します。ibtools はランダムに動作しています。sudo を使用すると、最終的にうまくいきました。

次に例を示します。

$ibtool --generate-strings-file en.lproj/MyVC.strings en.lproj/MyVC.xib
<?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 "MyVC.xib" because it does not exist.</string>
    </dict>
</array>
</dict>
</plist>

sudo の使用は毎回機能しますが、「ユーザー ドメインが揮発性になる」という不平を言うことがあります。

$sudo ibtool --generate-strings-file en.lproj/MyVC.strings en.lproj/MyVC.xib
2013-10-01 10:04:35.943 Interface Builder Cocoa Touch Tool[1717:303] CFPreferences: user       
home directory at file:///var/root/Library/Application%20Support/iPhone%20Simulator/User/ is unavailable. User domains will be volatile.
$
于 2013-10-01T14:24:56.447 に答える
1

ibtool が間違ったディレクトリで実行されています。相対パスではなく、常に ibtool への絶対パスを使用してください。

これは奇妙で、間違いなくバグです。ibtool が実際に Xcode の実行中のコピーに作業を行うように指示している可能性があります。

を使用する場合ibtool --output-format human-readable-text、エラー メッセージには開こうとしている実際のパスが含まれており、問題が明らかになります。

OSX には基本的なツールがなく、strace がなく、dtruss は root としてしか機能しないため、トラブルシューティングが面倒です。

于 2014-03-06T16:23:13.157 に答える
0

これは古い質問ですが、ストーリーボードで同様の問題に遭遇し、ibtool を呼び出すときにストーリーボードのフル パスを使用するインターネットで見つけたスクリプトを更新しました。以下にスクリプトがあります

#!/bin/sh
# Update storyboard string files
#
# by 2013 André Pinto andredsp@gmail.com
# based on http://forums.macrumors.com/showthread.php?t=1467446

storyboardExt=".storyboard"
stringsExt=".strings"
newStringsExt=".strings.new"
oldStringsExt=".strings.old"
localeDirExt=".lproj"
baselprojName="Base.lproj"

# Find Base internationalization folders
find . -name "$baselprojName" | while read baselprojPath
do
    # Get Base project dir
    baselprojDir=$(dirname "$baselprojPath")

    # Find storyboard file full path inside base project folder
    find "$baselprojPath" -name "*$storyboardExt" | while read storyboardPath
    do
        # Get Base strings file full path
        baseStringsPath=$(echo "$storyboardPath" | sed "s/$storyboardExt/$stringsExt/")

        # Get storyboard file name and folder
        storyboardFile=$(basename "$storyboardPath")
        storyboardDir=$(dirname "$storyboardPath")

        #Get the full path of the storyboard and the temporary string files. This is the fix for ibtool error
        storyboardFullPath=$(echo $(echo `pwd`)$(echo "$storyboardPath" | cut  -c2-))
        newBaseStringsFullPath=$(echo `pwd`"/Main.strings.new")

        echo "Full path of the storyboard $storyboardFullPath"
        echo "Full path of the temporary string files $newBaseStringsFullPath"

        # Get New Base strings file full path and strings file name
        stringsFile=$(basename "$baseStringsPath")

        # Create strings file only when storyboard file newer
        newer=$(find "$storyboardPath" -prune -newer "$baseStringsPath")
        [ -f "$baseStringsPath" -a -z "$newer" ] && {
            echo "$storyboardFile file not modified."
            continue
        }

        echo "Creating default $stringsFile for $storyboardFile..."

        ibtool --export-strings-file "$newBaseStringsFullPath" "$storyboardFullPath"
        iconv -f UTF-16 -t UTF-8 "$newBaseStringsFullPath" > "$baseStringsPath"
        rm "$newBaseStringsFullPath"

        # Get all locale strings folder with same parent as Base
        ls -d "$baselprojDir/"*"$localeDirExt" | while read localeStringsDir
        do
            # Skip Base strings folder
            [ "$localeStringsDir" = "$storyboardDir" ] && continue

            localeDir=$(basename "$localeStringsDir")
            localeStringsPath="$localeStringsDir/$stringsFile"

            # Just copy base strings file on first time
            if [ ! -e "$localeStringsPath" ]; then
                echo "Copying default $stringsFile for $localeDir..."
                cp "$baseStringsPath" "$localeStringsPath"
            else
                echo "Merging $stringsFile changes for $localeDir..."
                oldLocaleStringsPath=$(echo "$localeStringsPath" | sed "s/$stringsExt/$oldStringsExt/")
                cp "$localeStringsPath" "$oldLocaleStringsPath"

                # Merge baseStringsPath to localeStringsPath
                awk '
NR == FNR && /^\/\*/ {
    x=$0
    getline
    a[x]=$0
    next
}
/^\/\*/ {
    x=$0
    print
    getline
    $0=a[x]?a[x]:$0
    printf $0"\n\n"
}'  "$oldLocaleStringsPath" "$baseStringsPath" > "$localeStringsPath"

                rm "$oldLocaleStringsPath"
            fi
        done
    done
done
于 2013-12-10T12:22:08.933 に答える
0

私も「Interface Builder could not open the document "YourStupid.xib" because it does not exist.」のようなメッセージを受け取っていました。

私にとってうまくいったのは、デフォルトのXcodeを設定することでした。私のシステムには 2 つのバージョンの Xcode があり、古い方を使用したことはありませんが、まだ存在しています。App Store 経由ではなく、ダウンロード ページから Xcode をインストールしました。ここでは Xcode 5.0 について話しています。デフォルトの Xcode を使用するように設定するには、sudo を使用して次のコマンドを実行します。xcode-select を実行するには sudo が必要です。

sudo xcode-select -s /Applications/Xcode.app

その後、私の ibtool は再び機能しました。そして、私にとっては、ここで言及されている sudo ソリューションがなくても機能します。

ドキュメント セットをインストールした後、この問題が発生したように感じます。ここでいくつかの投稿を読み、何が変わったのかを考えた後、最初の Jenkins のインストール、Xcode、およびアクセス許可 (sudo コマンド) で過去に抱えていた問題について考え、このコマンドに戻ってきました。

これまでのところ、これは私にとってはうまくいきました。それ以来、問題は見られません。あなたのマイレージは異なる場合があります。

于 2013-12-16T21:28:17.260 に答える