Jacksonkr
Jacksonkr

Reputation: 32227

xcode Resolve "Safe Area Layout" errors

Illegal Configuration - Safe Area Layout Guide before iOS 9.0

What is the correct way to stop this error?

For now I'm merely unchecking "Use Safe Area Layout Guides" which allows me to compile the app without error.

Upvotes: 27

Views: 9042

Answers (6)

Fred T
Fred T

Reputation: 41

I believe it is imperative to support the latest iOS devices such as iPhone X, iPhone XS, and iPhone XR. The accepted answer to this question fails to address this. In Interface Builder, the Safe Area is a layout guide representing the portion of your view that is unobscured by bars and other content. In iOS 11+, Apple is deprecating the top and bottom layout guides and replacing them with this Safe Area Layout guide.

To resolve this Illegal Configuration Build error you should:

  1. Update your project file to support a Deployment Target of iOS 9, not iOS 8.

  2. Click on the 'Clean Build Folder' menu item off the Project menu.

  3. Close xCode 10, and then restart it.

  4. Rebuild your app.

Note that the 'Illegal Configuration' build error no longer appears, and you are now able to run your app in the simulator of your choice.

Upvotes: 0

Anton Tropashko
Anton Tropashko

Reputation: 5806

In my case all deployment targets had to be raised from 8.0 to 9.0 :-[

In case you have to support 8.0 accepted answer works.

Upvotes: 6

 Dmitriy Greh
Dmitriy Greh

Reputation: 684

To resolve this issue you need to do next steps:

  1. You need to click on your ViewController in your Interface Builder.
  2. Then go to Attributes Inspector. And click there on "File Inspector".
  3. Disable "Use Safe Area Layout Guides".

Use safe area layout guides disabled

Upvotes: 40

S Yoshida
S Yoshida

Reputation: 338

Try closing and then reopening Xcode.

Upvotes: 0

Aximem
Aximem

Reputation: 732

If you encounter this error with your CocoaPods, you must force your pods deployment target in podfile with minimum iOS 9.0, XCode 9 should manage this case but this is not working at the time of writing

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
    end
  end
end

Upvotes: 0

Joey
Joey

Reputation: 2968

Apple told us in WWDC 2017 Session 412 that Safe Area Layout Guide is Backwards deployable. But it seems to be not supporting iOS 8.0. I've got the same error on Xcode 9 GM too.

In my case, I stopped using the Safe Area Layout Guide, but use Top Layout Guide and Bottom Layout Guide, even though they are deprecated on iOS 11.

Upvotes: 8

Related Questions