iOS 9.0 之前的 UIStackView
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31758808/
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
UIStackView before iOS 9.0
提问by bably
I recently upgraded XCode to the latest Version 7.0 beta 3 (7A152u).
我最近将 XCode 升级到最新版本 7.0 beta 3 (7A152u)。
I am using Swift for building an iPhone app and when I try to use a Stack View in Main.storyboard I get the error "UIStackView before iOS 9.0".
我正在使用 Swift 构建 iPhone 应用程序,当我尝试在 Main.storyboard 中使用 Stack View 时,出现错误“ iOS 9.0 之前的 UIStackView”。
I thought with the upgrade to Xcode 7 beta 3, I have iOS 9. Please correct my understanding as I am quite new to Swift development.
我想升级到 Xcode 7 beta 3,我有 iOS 9。请纠正我的理解,因为我对 Swift 开发很陌生。
回答by EI Captain v2.0
Check inProject Targets-> Deployment info -> Deployment Target
.If it's not 9.0 change it to 9.0.
签入Project Targets-> Deployment info -> Deployment Target
。如果不是 9.0,请将其更改为 9.0。
You need to change the deployment target of your application's target to iOS 9. Otherwise the app supports down to whatever OS that your deployment target is set to.
您需要将应用程序目标的部署目标更改为 iOS 9。否则该应用程序支持您的部署目标设置为的任何操作系统。
Not solved?? Check out for other reason??? Check this:
没解决??检查其他原因???检查这个:
If your Deployment target is already set to 9.0 and you still get this error then try then check your project File inspector-> Project Document -> Project Format
and check if its Xcode-6.3-compatible
or not.If its not then set it to Xcode-6.3-compatible
.
如果您的部署目标已经设置为 9.0 并且您仍然收到此错误project File inspector-> Project Document -> Project Format
,请尝试检查您的并检查Xcode-6.3-compatible
它是否存在Xcode-6.3-compatible
。如果不是,则将其设置为。
The other reason is may be you accidentally add UIStackView
and thats why you encounter the problem. UIStackView
supports 9.0 and later and your deployment target doesn't allow that. So just check if you accidentally add UIStackView
and if you added and you don't want it than just remove it.
另一个原因可能是您不小心添加了UIStackView
,这就是您遇到问题的原因。UIStackView
支持 9.0 及更高版本,而您的部署目标不允许这样做。因此,只需检查您是否不小心添加,UIStackView
以及是否添加并且您不想要它,而不仅仅是将其删除。
Note: setting the deployment target to 9.0 means that only devices running iOS9 will be able to run your app
注意:将部署目标设置为 9.0 意味着只有运行 iOS9 的设备才能运行您的应用
回答by devios1
The accepted answer requires you to change your entire project deployment settings. If you don't want to require iOS 9 for your entire app, you can do this on an individual basis for a single xib or storyboard by setting the Builds forproperty in the file inspector pane of Xcode:
接受的答案要求您更改整个项目部署设置。如果您不想为整个应用程序要求 iOS 9,您可以通过在 Xcode 的文件检查器窗格中设置Builds for属性来单独为单个 xib 或故事板执行此操作:
Set this to iOS 9.0 or later and you will be able to continue to build your app for a lesser deployment target (7.0 in my case). Of course your app will crash if you attempt to load the xib on a device < iOS 9, so be sure to check this in code and take appropriate actions.
将此设置为 iOS 9.0 或更高版本,您将能够继续为较小的部署目标(在我的情况下为 7.0)构建您的应用程序。当然,如果您尝试在低于 iOS 9 的设备上加载 xib,您的应用程序会崩溃,因此请务必在代码中检查这一点并采取适当的措施。
回答by Felker
The previous answers don't actually address the idea of removing the offending UIStackView, rather they change the deployment target to correct the issue. My solution doesn't force you to change deployment targets.
以前的答案实际上并没有解决删除有问题的 UIStackView 的想法,而是更改了部署目标以纠正问题。我的解决方案不会强迫您更改部署目标。
I ran into this issue when I accidentally added a UIStackView (which is easy to do when adding layout constraints). To fix this issue, I went to the Document Outlet pane (shown below) and pulled my 'Round Style Text Field' out of the 'Stack View' hierarchy and into the 'View' hiearchy. Then you can delete the Stack View.
当我不小心添加了 UIStackView 时遇到了这个问题(添加布局约束时很容易做到)。为了解决这个问题,我转到“文档出口”窗格(如下所示)并将我的“圆形样式文本字段”从“堆栈视图”层次结构中拉到“视图”层次结构中。然后您可以删除堆栈视图。
This corrected the error for me, and I didn't have to change deployment targets. Hopefully this helps.
这为我纠正了错误,我不必更改部署目标。希望这会有所帮助。
回答by riot
In my case, my deployment target was already set to 9.0. I resolved this error by updating the project format from Xcode-3.2-compatible
to Xcode-6.3-compatible
.
就我而言,我的部署目标已经设置为 9.0。我从更新项目格式解决了这个错误Xcode-3.2-compatible
来Xcode-6.3-compatible
。
This can be found on the main Settings page of your Xcode project in the right column.
这可以在 Xcode 项目的主设置页面的右栏中找到。