Can't use safe areas in Xcode 9 after upgradin

2019-03-14 22:47发布

问题:

I have just changed my app from supporting iOS 8 and up to supporting iOS 9 and up. I believe I've done this properly, since when I now build my app, I'm getting warnings for everything in the app which was deprecated in iOS 9.

I am using Xcode 9, GM seed.

The problem is that I cannot enable the "Use Safe Area Layout Guides" toggle in any of my storyboards. When I do, I get a warning "Safe Area Layout Guide before iOS 9.0". Is there some additional setting that I need to update? A clean and build did not fix the problem.

回答1:

Just deselect "Use Safe Area Layout Guides" option, which should fix this. A screenshot below may point you the right direction. Hope this image can help



回答2:

When you changed the deployment target, did it automatically change the deployment target in your storyboard? (File inspector when opening the Storyboard)

Did you update the deployment target in both the Project and in (all) your target(s)?

Project:

Target:



回答3:

I didn't try quitting Xcode and restarting it before posting to SO! Sorry! The answer is, quit Xcode and try again.



回答4:

Simple fix.

In file inspector for the view, look for Builds For in Interface Builder Document and in there select iOS 9 and later.