UIStackView before iOS 9.0

2019-03-09 04:13发布

I recently upgraded XCode to the latest Version 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".

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.

标签: ios xcode ios9
4条回答
We Are One
2楼-- · 2019-03-09 04:52

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.

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.

enter image description here

This corrected the error for me, and I didn't have to change deployment targets. Hopefully this helps.

查看更多
爷、活的狠高调
3楼-- · 2019-03-09 04:53

Check inProject Targets-> Deployment info -> Deployment Target.If it's not 9.0 change it to 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.

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.

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.

Note: setting the deployment target to 9.0 means that only devices running iOS9 will be able to run your app

查看更多
Evening l夕情丶
4楼-- · 2019-03-09 05:00

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.

This can be found on the main Settings page of your Xcode project in the right column.

The Project Document section in the right column

查看更多
混吃等死
5楼-- · 2019-03-09 05:04

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 for property in the file inspector pane of Xcode:

enter image description here

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.

查看更多
登录 后发表回答