user2397282
user2397282

Reputation: 3818

iOS app won't work on iOS 6 or lower

I'm making an iPhone app using Xcode 5 and iOS 7 on my phone; The app works on iOS 7. However, when I ran the app on the iPhone 6.1 simulator, I got this message:

2013-09-01 10:46:30.075 Bars[30745:c07] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't
want. Try this: (1) look at each constraint and try to figure out which you don't
expect; (2) find the code that added the unwanted constraint or constraints and
fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you
don't understand, refer to the documentation for the UIView
property translatesAutoresizingMaskIntoConstraints) 
(
"<NSAutoresizingMaskLayoutConstraint:0x81b80a0 h=--- v=--- V:[UIWindow:0x8196f60(480)]>",
"<NSAutoresizingMaskLayoutConstraint:0x81b6910 h=-&- v=-&- UILayoutContainerView:0x8197530.height == UIWindow:0x8196f60.height>",
"<NSAutoresizingMaskLayoutConstraint:0x81b53b0 h=-&- v=-&- UITransitionView:0x75c0830.height == UILayoutContainerView:0x8197530.height - 49>",
"<NSAutoresizingMaskLayoutConstraint:0x81b40f0 h=-&- v=-&- UIViewControllerWrapperView:0x75f38e0.height == UITransitionView:0x75c0830.height>",
"<NSLayoutConstraint:0x75f5d10 V:[UILabel:0x75f6ee0(24)]>",
"<NSAutoresizingMaskLayoutConstraint:0x81b29b0 h=-&- v=-&- UIView:0x75f7500.height == UIViewControllerWrapperView:0x75f38e0.height>",
"<NSLayoutConstraint:0x7578850 V:[UILabel:0x75f7220]-(124)-|   (Names: '|':UIView:0x75f7500 )>",
"<NSLayoutConstraint:0x75fbfc0 UILabel:0x75f7220.baseline == UILabel:0x75f6ee0.baseline>",
"<NSLayoutConstraint:0x75fbcc0 V:[UIView:0x75f3ab0]-(11)-[UILabel:0x75f6ee0]>",
"<NSLayoutConstraint:0x75fbe40 V:|-(321)-[UIView:0x75f7160]   (Names: '|':UIView:0x75f7500 )>",
"<NSLayoutConstraint:0x75fbe80 UIView:0x75f7160.top == UIView:0x75f3ab0.top>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x75f5d10 V:[UILabel:0x75f6ee0(24)]>

Break on objc_exception_throw to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.

I tried deleting all constraints but I got errors saying I need constraints. I am new to Objective-C so I don't really know how to read these. If you could make your answer very simple that would be very helpful!

Upvotes: 0

Views: 235

Answers (2)

Tim Bodeit
Tim Bodeit

Reputation: 9693

Please keep in mind, that iOS 7 is still under NDA.

What this log means is, that you are using auto layout and you have two constraints, that are contradicting each other.

For example: Your view has constraints:

  • 10px top to superview
  • 60px bottom to superview
  • 498px height

This works with any superview, that is 568pt heigh. So for example on a fullscreen application on the iPhone 5. As soon as the size of the superview changes (so for example when the size of your device is different), you will get an error.

Try there two things:

  1. Never put all constraints on an object. Either do:

    • top & bottom spacing (this will change the height, when size changes)
    • top spacing & height (this will change the space on the bottom if the size changes)
    • bottom spacing & height (will change the space at the top)
    • same goes for left, right and width
  2. Try setting use Fullscreen on your viewcontroller. Because of NDA, I can not currently explain, what the difference between iOS 7 and iOS 6 is in respect to this, but I think it might help.

Upvotes: 5

Abdullah Shafique
Abdullah Shafique

Reputation: 6918

All you have to do is go in you view controller's file inspector and unselect Use Auto-Layout.

No Auto-Layout

Upvotes: -3

Related Questions