链接地址: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.

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.

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

7 Answers

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

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

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.

answered Sep 18 '13 at 23:57
 
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

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/

answered Sep 23 '13 at 18:33
 
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

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:

  1. Clean the project (press Cmd + Shift + K)
  2. Reset the simulator (iOS Simulator menu item -> "Reset Content and Settings")
  3. Restart Xcode
  4. Try building again, hopefully you can now
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

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

answered Dec 19 '13 at 11:52
 

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 :)

answered Jun 11 at 7:28
 

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.

answered Jun 10 at 12:22
Rahulkr
10119

iOS 7 - Auto Layout on iOS Versions prior to 6.0的更多相关文章

  1. uistepper on ios versions prior to 5.0

    xcode5 打开运行就出现这个错误 uistepper on ios versions prior to 5.0 直接在General -->Deployment Info -->Dep ...

  2. iOS Programming Auto Layout: Programmatic Constraints 自动布局:通过编程限制

    iOS Programming  Auto Layout: Programmatic Constraints  1.  However, if your views are created in co ...

  3. [Android开发学iOS系列] Auto Layout

    [Android开发学iOS系列] Auto Layout 内容: 介绍什么是Auto Layout. 基本使用方法 在代码中写约束的方法 Auto Layout的原理 尺寸和优先级 Auto Lay ...

  4. iOS 8 Auto Layout界面自动布局系列2-使用Xcode的Interface Builder添加布局约束

    http://blog.csdn.net/pucker/article/details/41843511 上一篇文章<iOS 8界面自动布局系列-1>简要介绍了iOS界面布局方式的前世今生 ...

  5. Auto Layout 在iOS屏幕适配中的使用

    前几天在做iOS屏幕的适配,也就是让同样的UI控件的布局在不同屏幕的iOS设备上面都正确显示,storyBoard就无可避免的用到了Auto Layout.在这个过程中,我发现要熟练掌握Auto La ...

  6. 【转 iOS 8 Auto Layout界面自动布局系列2-使用Xcode的Interface Builder添加布局约束

    原文网址:http://blog.csdn.net/pucker/article/details/41843511 上一篇文章<iOS 8界面自动布局系列-1>简要介绍了iOS界面布局方式 ...

  7. iOS 8 Auto Layout界面自动布局系列5-自身内容尺寸约束、修改约束、布局动画

    首先感谢众多网友的支持,最近我实在是事情太多,所以没有写太多.不过看到大家的反馈和评价,我还是要坚持挤出时间给大家分享我的经验.如果你对我写的东西有任何建议.意见或者疑问,请到我的CSDN博客留言: ...

  8. (iOS)使用auto layout进行复杂布局时,UILabel的相关trick

    本文转载至 http://blog.csdn.net/madongchunqiu/article/details/47960745  本文首发于CSDN:http://blog.csdn.net/ma ...

  9. IOS使用Auto Layout中的VFL适配

    做登录页面,之前做都是用frame做,今天想着用Auto Layout中的VFL来做.觉得做的效果还是可以的(自恋一下下). 首先看下效果图和标记图 自己在做的过程中也遇到了好多问题,不过也一个一个的 ...

随机推荐

  1. 84. 从视图索引说Notes数据库(下)

    作用和代价上文介绍了关系型数据库里的索引.Notes数据库里的索引隐藏在视图概念里(本文的讨论仅仅针对Notes的视图索引,不包括全文索引.).开发者创建的视图仅仅是存放在数据库里的一条设计文档.数据 ...

  2. HDU2795 billboard【转化为线段树。】

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2795 hhanger大神的题目,水题都得有点思维. 题意:h*w的木板,放进一些1*L的物品,求每次放 ...

  3. IOS文件沙盒

    在进行IPhone开发的时候,常常需要将简单的数据保存到文件中,以便下次再重新打开的时候能够读取文件中保存的数据. 下面就来做一个简单的demo: 步骤: 1.创建一个SingleView项目,带有x ...

  4. Linux通过网卡驱动程序和版本号的信息

    检查卡制造商和信号 查看基本信息:lspci 查看详情:lspci -vvv   # 3小作文v 查看卡信息:lspci | grep Ethernet 查看网卡驱动 查看网卡驱动信息:lspci - ...

  5. String的几种比较方法对比(Compare,CompareTo, CompareOrdinal、Equals)

    String类字符串比较大概有4种方法:Compare(),CompareTo(), CompareOrdinal()和Equals(). Compare()方法是CompareTo()的静态版本.而 ...

  6. C#主键类型选择

    1.SQL Server中两种常用的主键数据类型:int(或者bigint)+标识列(又称自动增长字段) uniqueidentifier(又称Guid.UUID) 2.Guid算法是一种可以产生唯一 ...

  7. 建立&修改视图

    一.建立视图 IF OBJECT_ID('Sales.OrderTotalsByYear', 'V') IS NOT NULL DROP VIEW Sales.OrderTotalsByYear; G ...

  8. 自定义cell时,在宽的手机上显示太窄解决办法

    1.工程设置要如下:见第二个红框,清除launch screan file 后面的内容 2.自定义的cell要设置auto layout 和size clases

  9. 【Linux命令】杀死僵尸程序

    A zombie is already dead, so you cannot kill it. To clean up a zombie, it must be waited on by its p ...

  10. easyui-datagrid通过action从数据库获取数据的关键代码

    实际上是结合struts2来从数据获取json格式的数据.   关键代码: GetUserAction.java代码   package com.log.control; import java.io ...