xcode iOS5 故事板错误:故事板在 iOS 4.3 及更早版本上不可用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7781483/
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
iOS5 Storyboard error: Storyboards are unavailable on iOS 4.3 and prior
提问by Alex Stone
I've built a small app using storyboards and it ran great. Just before final testing I decided to try it out to see if it runs on iOS 4.3. I clicked on the gray 5.0 in the project settings and selected 4.3.
我使用故事板构建了一个小应用程序,并且运行良好。就在最终测试之前,我决定尝试一下,看看它是否能在 iOS 4.3 上运行。我在项目设置中点击了灰色的5.0,选择了4.3。
The app failed to build with the following error message:
应用程序构建失败并显示以下错误消息:
Storyboards are unavailable on iOS 4.3 and prior
故事板在 iOS 4.3 及更早版本上不可用
Both the iPhone and iPad storyboards tell me that.
iPhone 和 iPad 故事板都告诉我这一点。
The issue that when I switched back to iOS5 target, I still keep getting these errors from both storyboards, and the product won't build!I checked: iOS Deployment target in projects settings is 5.0 Target app deployment target is 5.0 Build settings uses iOS 5.0 SDK
问题是当我切换回 iOS5 目标时,我仍然不断从两个故事板中收到这些错误,并且产品无法构建!我检查了:项目设置中的 iOS 部署目标是 5.0 目标应用程序部署目标是 5.0 构建设置使用 iOS 5.0 SDK
What else do I need to do to restore my project to a buildable state? Is this a brand new bug or am I forgetting something?
我还需要做什么才能将我的项目恢复到可构建状态?这是一个全新的错误还是我忘记了什么?
Update: I kept getting this error even after doing a clean. I changed the debugger in Schemes to "LLDB" and did an additional clean, the project now builds and compiles
更新:即使在进行清理后,我仍然收到此错误。 我将 Schemes 中的调试器更改为“LLDB”并进行了额外的清理,该项目现在可以构建和编译
回答by cotton5415
I also got this problem and finally I solved this by following procedure:
我也遇到了这个问题,最后我通过以下程序解决了这个问题:
- Open XXXXXX.storyboard
- Open Identity and Type tab in your right view of Xcode.
- Set the value of Development in Document Versioning to "Xcode 4.2" (my default value is "Default Version (Xcode 4.1)".
- Change the value of Deployment from Project SDK Version (iOS 5.0) to iOS 5.0, then back to Project SDK Version (iOS 5.0)
- 打开 XXXXXX.storyboard
- 在 Xcode 的右侧视图中打开 Identity and Type 选项卡。
- 将 Document Versioning 中 Development 的值设置为“Xcode 4.2”(我的默认值为“Default Version (Xcode 4.1)”。
- 将 Deployment 的值从 Project SDK Version (iOS 5.0) 改成 iOS 5.0,再改回 Project SDK Version (iOS 5.0)
Rebuild the project and the error should be resolved.
重建项目,错误应该得到解决。
回答by C Fraire
The solution that worked for me was just to delete the ~/Library/Developer/Xcode/DerivedData
directory for my project.
对我有用的解决方案只是删除~/Library/Developer/Xcode/DerivedData
我的项目的目录。
回答by FractalDoctor
I'm just going to add this one as another possible answer here, as the first solutions worked for me several times (as I mentioned in my previous comment) until today when I couldn't get my project to compile for love nor money with the same error. With the debugger changed and Xcode set to 4.2 and restarting several times I could not compile. However I discovered another way to get around this issue.
我只想在这里添加这个作为另一个可能的答案,因为第一个解决方案对我有用过几次(正如我在之前的评论中提到的),直到今天我无法让我的项目为爱或金钱编译同样的错误。更改调试器并将 Xcode 设置为 4.2 并重新启动几次后,我无法编译。但是,我发现了另一种解决此问题的方法。
Select the storyboard in the left column and 'Show in Finder' and drag the storyboard to the desktop. Xcode will now change its colour to red and be unable to compile.
选择左栏中的情节提要和“在 Finder 中显示”并将情节提要拖到桌面上。Xcode 现在将其颜色更改为红色并且无法编译。
Clean the project, drag the storyboard back from the desktop to the directory in finder.
清理项目,将storyboard从桌面拖回finder中的目录。
Then, it builds and the error goes away again.
然后,它构建并且错误再次消失。
I don't know what triggered the error originally as I'm developing under iOS5 and building for 4.3, but it seems to come up from time to time and.
我不知道最初是什么触发了错误,因为我正在 iOS5 下开发并为 4.3 构建,但它似乎不时出现并且。
回答by Peter Brooks
This seems to be a bug in the latest XCode that I've also run into too, did try the OP's solution of changing debugger and that had no effect.
这似乎是我也遇到过的最新 XCode 中的一个错误,确实尝试了 OP 更改调试器的解决方案,但没有任何效果。
It cropped up for me since I tried storyboard with 4.3 and then tried to change back.
自从我尝试使用 4.3 的故事板然后尝试更改回来后,它突然出现在我身上。
My solution was to close XCode, open it again and clean. Then I compiled and it worked fine.
我的解决方案是关闭 XCode,再次打开并清理。然后我编译,它工作正常。
Hope this helps others.
希望这对其他人有帮助。
回答by Tyler Collier
While other solutions helped me, they didn't work 100% of the time. I don't know enough about XCode to know how reliable this solution is, but at least it worked for me so you can try it in your project.
虽然其他解决方案对我有帮助,但它们并不能 100% 地起作用。我对 XCode 的了解还不够多,不知道这个解决方案有多可靠,但至少它对我有用,所以你可以在你的项目中尝试它。
In the left hand side of Xcode, open the project navigator. Click the top item, which is your project. In the panel immediately to the right, you'll see a choice to choose between your project and its targets. Click the project, and then in the panel to the right, under the "Info" tab, set "Command-line builds use" to Debug (in my two projects where I was having the error, both were set to Release).
在 Xcode 的左侧,打开项目导航器。单击最上面的项目,这是您的项目。在右侧的面板中,您将看到在项目及其目标之间进行选择的选项。单击项目,然后在右侧面板中的“信息”选项卡下,将“命令行构建使用”设置为调试(在我遇到错误的两个项目中,都设置为发布)。
A picture is probably easiest:
一张图片可能是最简单的:
Another idea: Open another project with storyboards in Xcode and try to run that. If it succeeds, you can come back to the current project and it should build. I think this clearly indicates a bug in Xcode.
另一个想法:在 Xcode 中打开另一个带有故事板的项目并尝试运行它。如果成功,您可以返回当前项目,它应该构建。我认为这清楚地表明 Xcode 中存在错误。
回答by jeannicolas
After trying all the answers in here (removing the Storyboard reference, quitting Xcode, cleaning, changing debugger, etc.), none worked (with Xcode 4.5).
在尝试了这里的所有答案(删除 Storyboard 参考、退出 Xcode、清理、更改调试器等)后,没有一个起作用(使用 Xcode 4.5)。
The only way I got it to rebuild (and it was a total guess) was to open the Storyboard file in a text editor and delete the following line:
我让它重建的唯一方法(完全是猜测)是在文本编辑器中打开 Storyboard 文件并删除以下行:
<deployment version="1280" identifier="iOS"/>
It should be near the top of the file, in the <dependencies>
section. After that, the project was built successfully and Xcode even re-added that line to the file, but, it still builds...
它应该靠近文件的顶部,在该<dependencies>
部分中。之后,项目构建成功,Xcode 甚至将该行重新添加到文件中,但是,它仍然构建...
Go figure...! Hopefully it can help someone!
去搞清楚...!希望它可以帮助某人!
回答by Joe D'Andrea
At last, an elegant workaround that seems to do the trick for me! (I sure hope it works for everyone else. This one's stubborn.)
最后,一个优雅的解决方法似乎对我有用!(我当然希望它对其他人有用。这个人很固执。)
Once your settings are back safely in iOS 5-land, try Cmd-Option-Shift K(aka "Clean Build Folder..." from the menu - hold down Option to see it), thenbuild.
一旦您的设置在 iOS 5-land 中安全返回,请尝试Cmd-Option-Shift K(也就是菜单中的“Clean Build Folder...” - 按住 Option 以查看它),然后构建。
回答by MichaelBadichi
the solution is simple, right click your storyboard file, and show in finder then select the folder where the file is (this would probably be in the en.lproj folder) right click on the MainStoryboard.storyboard file causing the problem and open with text edit find the line that reads or something like this:
解决方案很简单,右键单击您的故事板文件,然后在 finder 中显示,然后选择文件所在的文件夹(这可能在 en.lproj 文件夹中)右键单击导致问题的 MainStoryboard.storyboard 文件并用文本打开编辑找到读取或类似这样的行:
<development version="4300" defaultVersion="4200" identifier="xcode"/>
and change it to something like this:
并将其更改为如下所示:
<development defaultVersion="4300" identifier="xcode"/>
save the file and build. Et voila...
保存文件并构建。等等……
回答by Mohammad Aljaber
Ok, I tried everything above and problem still occurred. So I just remove storyboards (as reference not move to trash). then build successfully; after that I added them again; Build, And finally worked.
好的,我尝试了上述所有方法,但问题仍然存在。所以我只是删除故事板(作为参考而不是移到垃圾箱)。然后构建成功;之后我又添加了它们;构建,终于奏效了。
回答by jeevangs
I was having the same problem. I tried all the above answers and all combinations and nothing worked. Then later after doing some research, I analysed that the simple fact that the error that was throwing at me was straight forward.
我遇到了同样的问题。我尝试了上述所有答案和所有组合,但没有任何效果。后来在做了一些研究之后,我分析了一个简单的事实,即向我抛出的错误是直截了当的。
Just go to the Build settings and instead of selecting the xcode project file, select the product file and change the Deployment target to 5.0 or 5.1. The error should go off.! I did this in Xcode 4.3 in Lion OSX. It worked fine for me!!
只需转到构建设置,而不是选择 xcode 项目文件,而是选择产品文件并将部署目标更改为 5.0 或 5.1。错误应该消失。!我在 Lion OSX 的 Xcode 4.3 中做到了这一点。它对我来说很好用!!