Can't use safe areas in Xcode 9 after upgradin

2019-03-14 23:21发布

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.

4条回答
疯言疯语
2楼-- · 2019-03-14 23:30

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

查看更多
姐就是有狂的资本
3楼-- · 2019-03-14 23:36

Simple fix.

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

查看更多
老娘就宠你
4楼-- · 2019-03-14 23:37

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

Storyboard File Inspector

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

Project:

Project

Target:

Target

查看更多
乱世女痞
5楼-- · 2019-03-14 23:50

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

alt screenshot

查看更多
登录 后发表回答