سؤال

I have an enterprise iPad app that runs on several iPads of different vintage. All work fine except for one which is the only 1st generation iPad in the group. This iPad is running iOS 5.1.1. The app uses a UIPopoverController in several places and all work fine on this iPad except for the one that I last created.

Using the iPad 5.1 Simulator I was able to duplicate the problems…

  1. The app crashes when trying to open a UIPopoverController which contains a UIViewController contining a UIDatePicker and a UIButton. The exception reads…

* Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named NSLayoutConstraint'

Here is the code I am using up to the line that throws the exception…

DatePickerPopOverViewController *datePickerViewController =[[DatePickerPopOverViewController alloc] init];
datePickerViewController.defaultDate = lastPopoverDate;
datePickerViewController.buttonTitle = @"Get Schedule";
datePickerViewController.delegate = self;
UIPopoverController *datePickerPopOver = [[UIPopoverController alloc] initWithContentViewController:datePickerViewController];

I am pretty sure that all of the elemnts involved are available in iOS5.1. Any suggestions would be greatly appreciated.

John

هل كانت مفيدة؟

المحلول

You can not use autolayout below iOS 6.0. The exception you are seeing is a result of this. NSLayoutConstraint is the class used to define interface element relationships when using autolayout.

To continue to target versions below iOS 6.0, simply uncheck "Use Autolayout" in the IB interface.

enter image description here

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top