xcode 故事板内部不一致
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18967190/
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
Storyboard Internal Inconsistencies
提问by Beto
I have a similar situation explain on this thread (XCode 5 Storyboard Internal Inconsistencies), but I installed the final version of the Xcode and never installed any beta version. Additionally, I can't add comments in previous thread cause I don't have enough points. So i need to ask my specific case.
我在这个线程上有类似的情况解释(XCode 5 Storyboard Internal Inconsistencies),但我安装了 Xcode 的最终版本并且从未安装过任何测试版。此外,我无法在之前的线程中添加评论,因为我没有足够的积分。所以我需要问我的具体情况。
In XCode 5, I have a problem with all of my projects "The document 'main.storyboard' has X internal inconsistencies that were found and repaired. Please save this document to fix the inconsistencies."
在 XCode 5 中,我的所有项目都存在问题“文档‘main.storyboard’有 X 内部不一致,已找到并修复。请保存此文档以修复不一致。”
If you choose to list the inconsistencies, you see that it's saying that some Images in my resources section, that uses this image, and is duplicating in the Storyboard. I try to save the document, but it does nothing, and when I relaunch the project, I get the same error.
如果您选择列出不一致之处,您会看到我的资源部分中的某些图像使用此图像,并且在故事板中重复。我尝试保存文档,但它什么也没做,当我重新启动项目时,我遇到了同样的错误。
I try all this things with NO SUCCESS:
我尝试了所有这些都没有成功:
- I delete all duplicates in storyboardFile file.
- Drop the image file from my project and add again.
- Reconnect UIButtons with the problem image.
- Change the image name file.
- 我删除了 storyboardFile 文件中的所有重复项。
- 从我的项目中删除图像文件并再次添加。
- 重新连接 UIButtons 与问题图像。
- 更改图像名称文件。
In my research, also I create a new project in XCode 5, add a same image in two objects inside Storyboard and got the same message.
在我的研究中,我还在 XCode 5 中创建了一个新项目,在 Storyboard 内的两个对象中添加相同的图像并得到相同的消息。
Anyone have the similar problem?, and more important, anyone have a solution?
有人有类似的问题吗?更重要的是,有人有解决方案吗?
I have XCode 5 and OSX 10.8.5.
我有 XCode 5 和 OSX 10.8.5。
**** UPDATE ***** I found a workaround. The error is generated when one image inside the storyboard is used several times, if you delete the reference of the image and assign the image to the object by code, the error disappears, but I don't like it. I'll research a little more, but apparently is a bug from Xcode (I hope not).
**** 更新 ***** 我找到了一个解决方法。多次使用storyboard中的一张图片时会产生错误,如果删除图像的引用并通过代码将图像分配给对象,错误就会消失,但我不喜欢它。我会再研究一点,但显然是 Xcode 的一个错误(我希望不是)。
采纳答案by Beto
After installing Mavericks and Xcode 5.0.1 the problem was fixed.
安装 Mavericks 和 Xcode 5.0.1 后,问题得到解决。
回答by KaterGreg
An easy way to fix this problem is to open up the Storyboard in TextEdit, then go down to the resources section at the end and delete any duplicate entries for images you see. They're sorted alphabetically, so it's fairly simple to do.
解决此问题的一个简单方法是在 TextEdit 中打开 Storyboard,然后转到最后的资源部分并删除您看到的图像的所有重复条目。它们按字母顺序排序,因此操作起来相当简单。
Saved the file, loaded up XCode and no more error messages.
保存了文件,加载了 XCode,没有更多的错误消息。
回答by Marcy
This problem occurred for me Xcode 10.1 but was resolved. The error message provided a "Show Details" button.
这个问题发生在我的 Xcode 10.1 上,但已解决。错误消息提供了“显示详细信息”按钮。
Clicking on Show Details showed my problem, a duplicate.
Right-clicked on the identified storyboard (Main.storyboard) to open as source code.
右键单击已识别的故事板 (Main.storyboard) 以作为源代码打开。
Searched for the duplicate declarations and removed one of the duplicates.
The error message no longer occurs including when the storyboard is reopened.
该错误消息不再出现,包括重新打开情节提要的时间。
回答by Robert
I upgraded to Xcode 5 last night and am experiencing multiple issues, including the one you described above. I also seem to have found a workaround, albeit different from the one you found.
我昨晚升级到 Xcode 5 并且遇到了多个问题,包括您上面描述的问题。我似乎也找到了一种解决方法,尽管与您找到的方法不同。
To get rid of it I saved the project, closed it, opened a different project and ran it in the simulator, quit Xcode then reloaded the original project.
为了摆脱它,我保存了项目,关闭了它,打开了一个不同的项目并在模拟器中运行它,退出 Xcode 然后重新加载原始项目。
Error message no longer appeared.
错误信息不再出现。
I have no idea why but this seems to have solved it for me.
我不知道为什么,但这似乎已经为我解决了。
Now to tackle the other niggles......... :-/
现在解决其他小问题.........:-/
回答by solange
Same error today after upgrading to Xcode 5: internal inconsistencies relating to images that are used more than once in storyboard, but I found a solution that worked for me here: https://devforums.apple.com/message/883402#883402.
今天升级到 Xcode 5 后出现同样的错误:与在情节提要中多次使用的图像相关的内部不一致,但我在这里找到了一个对我有用的解决方案:https: //devforums.apple.com/message/883402#883402。
I created a new Asset Catalog (New file / choose "Resource" / Asset Catalog).
我创建了一个新的资产目录(新文件/选择“资源”/资产目录)。
Once created, I selected the option 'Import from project' and imported all my images. Seems to have done the trick.
创建后,我选择了“从项目导入”选项并导入了我的所有图像。似乎已经成功了。