I am running into a very strange issues that I can't seem to figure out how to get working. When I debug my application on my device or on a simulator I don't get any errors. When I build it for ad-hoc deployment, the app throws an exception and fails. The error I'm getting in the log is
[NSISEngine tryToAddConstraintWithMarker:expression:integralizationAdjustment:mutuallyExclusiveConstraints:]
My layout looks like this across the board for all of my views.

My constraints stretch views out to the full width of the screen, and I'm creating a dynamic width constraint on the views in my BaseViewController that gets inherited by all the other ones. I've created my delegates for the scrollView and contentView for each of my subviews.
class BaseViewController: UIViewController, UITextFieldDelegate {
var activeField:UITextField?
@IBOutlet weak var scrollView: UIScrollView?
@IBOutlet weak var contentView: UIView?
override func viewDidLoad() {
if(self.scrollView != nil)
{
// Do any additional setup after loading the view.
let leftConstraint:NSLayoutConstraint = NSLayoutConstraint(item: self.contentView!, attribute: NSLayoutAttribute.Leading, relatedBy: NSLayoutRelation.Equal, toItem: self.view, attribute: NSLayoutAttribute.Left, multiplier: 1.0, constant: 0)
self.view.addConstraint(leftConstraint)
let rightConstraint:NSLayoutConstraint = NSLayoutConstraint(item: self.contentView!, attribute: NSLayoutAttribute.Trailing, relatedBy: NSLayoutRelation.Equal, toItem: self.view, attribute: NSLayoutAttribute.Right, multiplier: 1.0, constant: 0)
self.view.addConstraint(rightConstraint)
}
super.viewDidLoad()
}
I'm more than happy to provide any additional information, please just ask and I'll give you what I can.
EDIT
This only happens on archiving and running without connected to a debugger. If I debug a release build no issue.
import UIKit
class BaseViewController: UIViewController, UITextFieldDelegate {
var activeField:UITextField?
@IBOutlet weak var scrollView: UIScrollView!
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
self.view.endEditing(true);
}
func textFieldShouldReturn(field: UITextField) -> Bool
{
field.resignFirstResponder()
return true
}
func textFieldDidBeginEditing(sender: UITextField)
{
self.activeField = sender
}
func textFieldDidEndEditing(sender: UITextField)
{
self.activeField = nil
}
func keyboardDidShow(notification: NSNotification)
{
if(self.activeField != nil && self.scrollView != nil) {
if let keyboardSize = (notification.userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.CGRectValue() {
let contentInsets = UIEdgeInsets(top: 0, left: 0, bottom: keyboardSize.height, right: 0)
self.scrollView!.contentInset = contentInsets
self.scrollView!.scrollIndicatorInsets = contentInsets
var aRect = self.view.frame
aRect.size.height -= keyboardSize.size.height
if(!CGRectContainsPoint(aRect, self.activeField!.frame.origin)) {
self.scrollView!.scrollRectToVisible(self.activeField!.frame, animated: true)
}
}
}
}
func keyboardWillBeHidden(notification: NSNotification)
{
if(self.scrollView != nil) {
let contentInsets:UIEdgeInsets = UIEdgeInsetsZero
self.scrollView!.contentInset = contentInsets
self.scrollView!.scrollIndicatorInsets = contentInsets
}
}
}
My logs look like this now and I'm not sure what my issue is.
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_c.dylib 0x0000000193c19690 __sfvwrite + 0
1 libsystem_c.dylib 0x0000000193c20958 __vfprintf + 11352
2 libsystem_c.dylib 0x0000000193c3b67c __v2printf + 584
3 libsystem_c.dylib 0x0000000193bce208 _vsnprintf + 300
4 libsystem_c.dylib 0x0000000193bcec54 snprintf_l + 20
5 CoreFoundation 0x0000000181cc7018 __CFStringAppendFormatCore + 11580
6 CoreFoundation 0x0000000181cc42a0 _CFStringCreateWithFormatAndArgumentsAux2 + 244
7 Foundation 0x0000000182b0a444 -[NSPlaceholderString initWithFormat:locale:arguments:] + 168
8 Foundation 0x0000000182b0a304 +[NSString stringWithFormat:] + 72
9 yazda-ios 0x00000001000fcea0 +[NRMAThreadLocalStore currentThreadDictionary] (NRMAThreadLocalStore.m:238)
10 yazda-ios 0x00000001000fb678 +[NRMAThreadLocalStore threadLocalTrace] (NRMAThreadLocalStore.m:36)
11 yazda-ios 0x00000001000fc040 +[NRMAThreadLocalStore prepareSameThread:child:withParent:] (NRMAThreadLocalStore.m:126)
12 yazda-ios 0x00000001000fbac0 +[NRMAThreadLocalStore pushChild:forParent:] (NRMAThreadLocalStore.m:91)
13 yazda-ios 0x00000001000c92d4 +[NRMATraceController newTraceSetup:parentTrace:] (NRMATraceController.m:310)
14 yazda-ios 0x00000001000c97d8 +[NRMATraceController enterMethod:fromObject:parentTrace:traceCategory:withTimer:] (NRMATraceController.m:374)
15 yazda-ios 0x00000001000c95ac +[NRMATraceController enterMethod:fromObject:parentTrace:traceCategory:] (NRMATraceController.m:338)
16 yazda-ios 0x00000001000b4498 NRMA__beginMethod (NRMAMethodProfiler.m:1051)
17 yazda-ios 0x00000001000b406c NRMA__voidParamHandler (NRMAMethodProfiler.m:705)
18 yazda-ios 0x0000000100047f38 yazda_ios.BaseViewController.viewDidLoad (yazda_ios.BaseViewController)() -> () (BaseViewController.swift:32)
19 yazda-ios 0x00000001000b407c NRMA__voidParamHandler (NRMAMethodProfiler.m:707)
20 yazda-ios 0x0000000100047f38 yazda_ios.BaseViewController.viewDidLoad (yazda_ios.BaseViewController)() -> () (BaseViewController.swift:32)