iOS 7 - Auto Layout on iOS Versions prior to 6.0

2022-11-03,,,

链接地址:http://stackoverflow.com/questions/18735847/ios-7-auto-layout-on-ios-versions-prior-to-6-0

Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

iOS 7 - Auto Layout on iOS Versions prior to 6.0

up vote42down votefavorite

7

I have an iOS app that worked well on all devices in iOS 6.

I recently upgraded my xcode to version 5.0 and tried to build the same app for iOS 7 on an iPhone 5.

On building the app, the xCode upgraded something in the code settings, but failed to build with errors.

On the iPad XIB, I get an error : "Illegal Configuration : Auto Layout on iOS Versions prior to 6.0".

I tried enabling and disabling the "Use Autolayout" checkbox in the File Inspector, but it didn't work.

Please help me fixing this issue.

ios autolayout ios7

shareimprove this question

edited Sep 12 '13 at 4:54
 
 

asked Sep 11 '13 at 8:08

metsburg
1,3021722

 
1  
Auto Layout is not supported before iOS 6. "Fix this isse": 1) don't use it. 2) require iOS 6. – David Rönnqvist Sep 11 '13 at 9:19
    
"Auto Layout is not supported before iOS 6"... I'm not using anything before iOS 6, I'm using iOS 7. Is it not compatible? –  metsburg Sep 11 '13 at 9:31
    
I said I upgraded my xCode to 5.0, why did you edit the tag to iOS 5? –  metsburg Sep 11 '13 at 9:33
    
"prior to iOS 6" is iOS 5 –  David Rönnqvist Sep 11 '13 at 9:33
1  
But I'm not using it, that is the point. –  metsburg Sep 11 '13 at 9:33

show 6 more comments

7 Answers

activeoldestvotes

up vote76down voteaccepted

Your problem is that the "Deployment Target" for your project is "5.0" and you are using a feature that isn't available for iOS 5.

Check the "General" tab for your build target

and update it to at least 6.0 to use Auto Layout

shareimprove this answer

answered Sep 11 '13 at 9:45

David Rönnqvist
31.8k1382124

 
2  
Yes, but the same code, when compiled in xcode 4.6.3, works fine. Evevn with deployment target as low as 4.3. –  metsburg Sep 11 '13 at 10:17
1  
agreed. I tried that and didn't see the error despite setting the deployment target to 5.0 –  Max MacLeod Sep 11 '13 at 10:20

add a comment

up vote39down vote

In your .xib file in Xcode 5, click on the offending control. Go to the properties menu on the right and click on the "File Inspector" tab. It is the tab that looks like a sheet of paper. On that tab, there is a section called "Interface Builder Document". Make sure "Builds for" property is set for "iOS 6.0 and Later". If none of the other fixes above have worked, this is likely your culprit.

shareimprove this answer

answered Sep 18 '13 at 23:57

Christine
55038

 
1  
NOTE --- If anyone is searching for this, I answered after the conversation was completed. This is the answer for this problem if the above does not fix it. I hope I can help you. ---- –  Christine Sep 20 '13 at 17:52 
    
This fixed it for me. The original value was Project Deployment (which I already set to 6.0) but it still didn't work with that setting. –  radj Sep 24 '13 at 8:09 
    
I was having this same problem after updating Xcode. This worked perfectly for me. –  GhostShaman Oct 11 '13 at 18:12
    
This works for me. –  Tony Xu Nov 11 '13 at 0:29

add a comment

up vote13down vote

There is very simple fix. You have just to uncheck "Use Auto Layout" in General tab. More information http://shreekantpawar.com/2012/12/20/simple-solution-to-auto-layout-on-ios-versions-prior-to-6-0-error-in-mac-osx-10-7-and-later/

shareimprove this answer

edited Oct 4 '13 at 19:23
 
 

answered Sep 23 '13 at 18:33

Anton Sivov
37729

 
3  
but... but...then you cant use autolayout anymore! The cure is worse than the desease! –  katzenhut Oct 29 '13 at 13:54
    
Agree. I've refactored all views in XCode 5 editor. –  Anton Sivov Oct 30 '13 at 11:14 
    
This is what worked for me. Although it is not in the General Tab, it is in the File Inspector tab. – Chuck Krutsinger Nov 13 '13 at 3:58
    
thank you this is work... –  Yug Jun 2 '14 at 13:35

add a comment

up vote7down vote

Assuming you are actually targeting only iOS 6.0+, it sounds like an issue related to upgrading Xcode. Sometimes, things can go awry when transitioning to a newer Xcode version.

Here are some general tips you can try:

    Clean the project (press Cmd + Shift + K)
    Reset the simulator (iOS Simulator menu item -> "Reset Content and Settings")
    Restart Xcode
    Try building again, hopefully you can now
shareimprove this answer

answered Sep 11 '13 at 10:17

JRG-Developer
4,93412152

 
    
No, that doesn't work. And I'm actually targeting iOS 5.0+. Does that mean we'll have to change minimum deployment target? –  metsburg Sep 11 '13 at 10:26
2  
Without going into much detail of Xcode 5 (I am under NDA...), it seems like it's now more difficult to support iOS 5+. Apple seems to be strongly encouraging developers to support iOS 6+ only. iOS 7 makes some pretty radical changes in places that have made it difficult to even support 6.0+... to this regard, we have dropped support for iOS 5 entirely. –  JRG-Developer Sep 11 '13 at 10:29 
    
Yes, agreed. I tried a few things but the only valid option seems to be upgrading the minimum deployment target. –  metsburg Sep 11 '13 at 11:00

add a comment

up vote1down vote

Autolayout is a feature of iOS6.0 and later, If you need to support iOS 5, don't use auto layout.

https://developer.apple.com/library/ios/releasenotes/General/WhatsNewIniOS/Articles/iOS6.html#//apple_ref/doc/uid/TP40011812-SW1

Please go through above doc, and check "What's new in iOS6.0" and serach for "Auto layout"

https://discussions.apple.com/message/19879144#19879144

shareimprove this answer

answered Dec 19 '13 at 11:52

Gaurav Borole
149113

  add a comment
up vote1down vote

This works for me..please try from classname.xib file in Xcode 5, tap on the offending control. tap on "File Inspector" tab. On that tab,Make sure "Builds for" property is set for "iOS 6.0 and Later".This will help you 🙂

shareimprove this answer

answered Jun 11 at 7:28

Vinu David Jose
314

  add a comment
up vote0down vote

The problem may be because of target version in of your project,it may be 5.0 i guess.There is a solution for this problem

step1.Select your project

step2.select the General tab

step3.change the project deployment target.

shareimprove this answer

answered Jun 10 at 12:22

Rahulkr
10119

iOS 7 - Auto Layout on iOS Versions prior to 6.0的相关教程结束。

《iOS 7 - Auto Layout on iOS Versions prior to 6.0.doc》

下载本文的Word格式文档,以方便收藏与打印。