xcode 无法打开文档“XXXX.xib”。无法读取存档
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17156004/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
The document "XXXX.xib" could not be opened. Could not read archive
提问by Spinoxa
After opening my project in the Xcode5 developer preview, errors appeared against a few .xib files when I tried to open the project in Xcode 4.5. The error text was:
在 Xcode5 开发人员预览版中打开我的项目后,当我尝试在 Xcode 4.5 中打开项目时,一些 .xib 文件出现错误。错误文本是:
The document "XXXX.xib" could not be opened. Could not read archive.
Please use a newer version of Xcode. Consider changing the document's Development Target to preserve compatibility.
The project's development target in Xcode5 appears to be iOS 5.0.
该项目在 Xcode5 中的开发目标似乎是 iOS 5.0。
Looking at the source code of the .xib files with errors, it is clear that the .xml structure for .xib files in Xcode5 has changed quite dramatically, and it needs to be reformatted to be backwards compatible.
查看有错误的 .xib 文件的源代码,很明显 Xcode5 中 .xib 文件的 .xml 结构发生了相当大的变化,需要重新格式化以向后兼容。
Is there a way to set development targets for specific .xib files? Does anyone know how this error can be resolved?
有没有办法为特定的 .xib 文件设置开发目标?有谁知道如何解决这个错误?
Many thanks.
非常感谢。
采纳答案by Idan
A better and easier solution that works even if your project isn't under source control can be found here (mine):
即使您的项目不受源代码控制,也可以在此处找到一个更好、更简单的解决方案(我的):
Just installed xcode 5 and have missing storyboards
Hope that helps.
希望有帮助。
回答by orafaelreis
Just open Storyboard in XCode 5, into right panel and "File Inspector" tab do:
只需在 XCode 5 中打开 Storyboard,进入右侧面板和“文件检查器”选项卡:
- edit your "Interface Builder Document" like follow:
- 编辑您的“接口生成器文档”,如下所示:
- Save it and open in previous XCode.
- 保存并在之前的 XCode 中打开。
回答by user2518512
First of all open project with Xcode5. and then
首先用Xcode5打开项目。进而
- select XXX.xib find Interface Builder Document
- Opens in Xcode 4.6(if is 5.0)
- close project
- open it with 4.6
- 选择 XXX.xib 找到 Interface Builder 文档
- 在 Xcode 4.6 中打开(如果是 5.0)
- 关闭项目
- 用 4.6 打开
回答by jc_35
It's a current problem when you open your Xcode 4.6 project with the new XCode 5. To reuse correctly your XIB with Xcode 4.6 :
当您使用新的 XCode 5 打开 Xcode 4.6 项目时,这是当前的问题。要使用 Xcode 4.6 正确重用您的 XIB:
1 Open your project with XCode 5
2 Select your Xib to restore
3 In the File Inspector Section, in "Interface Builder Document", select Xcode 4.6 in the Development's version of Document Versioning
4 Build and close
5 Reopen your project with XCode 4.6
1 使用 XCode 5 打开您的项目
2 选择要恢复的 Xib
3 在文件检查器部分的“接口生成器文档”中,在开发版本的文档版本控制中选择 Xcode 4.6
4 构建和关闭
5 使用 XCode 4.6 重新打开您的项目
It's possible to have some regression with elements width & size in your XIB, but it was restored successfully.
XIB 中的元素宽度和大小可能会出现一些回归,但它已成功恢复。
Cheers,
干杯,
回答by Adrian P
well obviously you created your project prior to the new xcode developer preview. then you tried opening your project with the new DP and boom, it automatically changed everything in your xibs to be able to present your xibs in a higher version. easy to fix. with your xcode 4 ios 6 open the same project, then right click on the name of the xib that is not opening and select source control and from there select discard changes. that should return the xib back to the shape it was before you opened it with the new xcode DP.
很明显,您在新的 xcode 开发人员预览版之前创建了您的项目。然后您尝试使用新的 DP 和吊杆打开您的项目,它会自动更改您的 xib 中的所有内容,以便能够以更高版本呈现您的 xib。易于修复。使用您的 xcode 4 ios 6 打开同一个项目,然后右键单击未打开的 xib 的名称并选择源代码管理,然后从那里选择丢弃更改。这应该将 xib 返回到使用新的 xcode DP 打开它之前的形状。
let me know if you need more help but that should take care of your problem.
如果您需要更多帮助,请告诉我,但这应该可以解决您的问题。
回答by Vishal Verma
- First you have to open your's project with newer version of Xcode.
- Right click on XXX.xib file and select "Show File Inspector."
- Go to Interface Builder Document.
- Change Development option with older version of Xcode.
- 首先,您必须使用较新版本的 Xcode 打开您的项目。
- 右键单击 XXX.xib 文件并选择“显示文件检查器”。
- 转到接口生成器文档。
- 使用旧版本的 Xcode 更改开发选项。
回答by fardelejo
Once I used to manage a project with XCode 5 xibs in XCode 4. I split xibs for each XCode version and made this build script that compiles xib to nib and place that nib them inside the app
曾经我曾经在 XCode 4 中使用 XCode 5 xibs 管理一个项目。我为每个 XCode 版本拆分了 xibs 并制作了这个构建脚本,将 xib 编译为 nib 并将该 nib 它们放在应用程序中
#get SDK version
SDK_VERSION=$(echo $SDKROOT | sed -e 's/.*iPhone\(OS\)*\(Simulator\)*\([0-9]*.[0-9]*\).sdk//')
if [ $SDK_VERSION == '7.0' ]; then
echo 'Current SDK is 7.0'
ibtool --compile ${TARGET_BUILD_DIR}/${TARGET_NAME}.app/output.nib ${PROJECT_DIR}/ProjectFolder/input.xib.xib
echo 'Copied nibs to' ${TARGET_BUILD_DIR}/${TARGET_NAME}.app
else
echo 'Current SDK is not 7.0 (SDK is' $SDK_VERSION')'
fi