2

I have an app which I have been developing for ios 6.1 and I finally got it to work as I wanted to.

Then just to test how it works on the older iPhones, I set the deployment target to 5.1 and when I ran it, the ui started looking messed up.

Would anyone know why this happens? And should I keep the deployment target to 6.1? And if so, how do I make sure that the app looks ok on the older versions of the iPhones?

ps - here is the crash when I check the auto layout option

 *** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named NSLayoutConstraint'
*** First throw call stack:
svick
  • 236,525
  • 50
  • 385
  • 514
Genadinik
  • 18,153
  • 63
  • 185
  • 284
  • I would start by looking into the logic that you are using that makes it appear the way it does. You would know better than any of us if we don't know the exact nature of your issue. Perhaps you are using deprecated methods, for starters. What is different about the UI? Is it upside down, is it yellow when it should be blue, does it play obscene noises when the device is rotated? Do you get any compile warnings? – Jeremy Feb 06 '13 at 01:19
  • @Jeremy actually I just double checked and it might have been because I turned off the "Auto Layout" checkbo in order for the older phones not to crash. But it kind of messed up how things look like. Would you know why that happens? – Genadinik Feb 06 '13 at 01:25
  • It seems clear that the Auto Layout is vital to the display of your views. I wouldn't ignore the crash issue. Since you require the Auto Layout, you will need to find the underlying issue causing the crash. If we can help you figure out your crash, then your original issue becomes a non-issue. To get you started, I refer you [to this post](http://stackoverflow.com/questions/11198981/presentviewcontroller-crash-on-ios-6-autolayout). – Jeremy Feb 06 '13 at 01:30
  • @Jeremy I just posted the error that happens when I run on the ios 5.1 emulator – Genadinik Feb 06 '13 at 01:37
  • 2
    @Genadinik your crash log is totally normal : `AutoLayout` is a full iOS 6 feature. You can't use it on iOS 5 and below. If you need your app to be compatible iOS 5 and below, you will need to disable `Autolayout` and setting up your views through `Autoresizing Mask` – Yaman Feb 06 '13 at 01:45
  • Yaman, I think you meant to say iOS6 and below. – Nitin Alabur Feb 06 '13 at 01:52
  • @Genadinik If you dont have very complex layout constraints, you can still get through by using autoresizing masks. AutoLayout lets you do a lot more than what AutoresizingMasks allow you to do. Either you create two separate targets, one using storyboards that use autolayout, and another using autoresizing masks, or just have one using autoresizing masks only (less work). – Nitin Alabur Feb 06 '13 at 01:54

1 Answers1

2

Autolayouts were introduced in iOS6.0

If you want your app to run on iOS5.x or 4.x you must disable or not use autolayouts, or version gate the use of autolayouts based on which iOS the device is running (which, is a pain).

The Deployment Target is the oldest iOS version you want your app to run on. if its iOS5.0, then it'll run on all devices having iOS5.0 or later

Here's a better answer

Community
  • 1
  • 1
Nitin Alabur
  • 5,812
  • 1
  • 34
  • 52