Interface Builder could not open the document “.xib” because it does not exist

后端 未结 4 1968
眼角桃花
眼角桃花 2020-12-05 23:43

I am localizing an app, following the steps listed here. I have successfully achieved that with around 45 .xib\'s, while just 4 of them gives me this error:

\"Interf

相关标签:
4条回答
  • 2020-12-06 00:16

    For me it works like this:

    • select project target
    • remove the file from the build phases tab in copy bundle resources
    • re add it to the build phases tab
    0 讨论(0)
  • 2020-12-06 00:18

    To me this happened after a Git merge. The project file must have changed so much that now it gives all these errors. Those sensitive project files...

    So anyway, what I ended up doing is just removing the files from the project (sending them to Trash) and then re-adding them to the project with a git checkout other_branch path/to/file

    After this, building the project did not throw this error anymore.

    • It seems to work fine also if you remove just the reference and then re-add the file to the project (no need to send it to Trash)
    • Important You should remove any red files from your Build Phases - Compile Sources of your target's settings. Those are files that XCode thinks are still there and thinks it should still try to compile, but when it doesn't find them, it gives back this error.
    0 讨论(0)
  • 2020-12-06 00:22

    I am having a problem using Xcode 5 that might be the same issue. ibtools is randomly working when generating or writing localized strings to/from xib files. I had to use sudo on some xib files to get it to work. 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 although it 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.
    $
    
    0 讨论(0)
  • 2020-12-06 00:35

    I experienced the same error when running ibtools on .xib files in two different directories. It worked fine with the files in the first directory, but failed on the files in the second directory. If I swapped the order of processing the directories it still failed for the second directory.

    Finally I discovered that ibtool starts a demon process ibtoold that doesn't terminate when ibtool finishes, and if I killed that process I no longer got the error. Apparently the demon has some state that hinders ibtool in working in another directory.

    I used pkill ibtoold to kill the demon.

    0 讨论(0)
提交回复
热议问题