5

Added a build script step that ran

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

This fails the build

<?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

When the project is first cleaned and then built, it will succeed the first time.

I tried to duplicate this in a sample project, but could not duplicate it. Our real project is much more complicated... has 6 languages, project has two targets (one for enterprise build and one for the store build). Many classes and two large storyboards.

Does anyone have suggestions what to try to do differently to figure out what is causing the problem to determine if it is a tool bug?

Jason Hocker
  • 6,879
  • 9
  • 46
  • 79
  • possible duplicate of [Interface Builder could not open the document ".xib" because it does not exist](http://stackoverflow.com/questions/8968715/interface-builder-could-not-open-the-document-xib-because-it-does-not-exist) – DanSkeel Dec 02 '14 at 16:00

4 Answers4

4

I am having the same issue using Xcode 5 with regular xib files. ibtools is randomly working. Using sudo finally did the trick for me.

Here's an example:

$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>

Using sudo works every time although it sometimes complains about 'user domains will be volatile'

$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.
$
n8tr
  • 5,018
  • 2
  • 32
  • 33
1

ibtool is running in the wrong directory. Always use absolute paths to ibtool, and not relative paths.

This is bizarre and definitely a bug; it may be that ibtool is actually telling a running copy of Xcode to do the work.

If you use ibtool --output-format human-readable-text, the error message includes the actual path it's trying to open, which reveals the problem.

This is a pain to troubleshoot, since OSX is missing basic tools--there's no strace, and dtruss only works as root.

Glenn Maynard
  • 55,829
  • 10
  • 121
  • 131
0

I know this is an old question but I ran into the similar problem with my storyboard and updated a script that I found on the Internet that uses the full path for the storyboard when calling ibtool. Below you will find the script

#!/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
Cosmin
  • 2,840
  • 5
  • 32
  • 50
  • Better see updated version https://github.com/ole/Storyboard-Strings-Extraction/blob/master/update_storyboard_strings.sh – DanSkeel Dec 02 '14 at 15:56
0

I too was getting a message like "Interface Builder could not open the document "YourStupid.xib" because it does not exist."

What worked for me was setting the default Xcode. I have two versions of Xcode on my system, and although I never use the older one, it is still there. I installed my Xcodes from the download page and not via the App Store. I'm talking about Xcode 5.0 here. To set the default Xcode to be used, run the following command using sudo. xcode-select requires sudo to run.

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

After that my ibtool worked again. And for me, it works without the sudo solutions mentioned here.

I have a feeling this problem cropped up after installing the documentation sets. After reading some of the posts here and thinking about what changed, I thought about problems I had in the past with my first Jenkins Installation, Xcode and permissions (sudo commands) and came back to this command.

So far this has worked for me and I haven't seen any problems since. Your mileage may vary.

Terry Dye
  • 74
  • 1
  • 4