XCode 7 Compilation Error with Swift - swift

Can someone help me fix this issue? I added another ViewController and modally linked it to the original view controller. It originally worked, but I ran it again because I made change in text and now it will not compile. I deleted all constraints and deleted the "button" that it says is not correctly linked.
2015-10-26 00:48:43.611 XXXX[5790:2031206] 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)
(
"<NSLayoutConstraint:0x15ce8dac0 V:|-(20)-[UIInputSetContainerView:0x15ce2e050] (Names: '|':UITextEffectsWindow:0x15ce694a0 )>",
"<NSLayoutConstraint:0x15ce8e630 'UIInputWindowController-top' V:|-(0)-[UIInputSetContainerView:0x15ce2e050] (Names: '|':UITextEffectsWindow:0x15ce694a0 )>")
Will attempt to recover by breaking constraint
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2015-10-26 00:48:44.446 XXXXX[5790:2031206] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<XXXXXX.CreateAnAccountViewController 0x15cd1fd40> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key SignUpLabel.'
*** First throw call stack:
(0x185198f5c 0x19a67ff80 0x185198c1c 0x18600f534 0x18aa4f9b8 0x18ab9b4b8 0x1850c2acc 0x18ab99ea0 0x18aa52cfc 0x18a827ea8 0x18a6ef258 0x18a6ef1b0 0x18af713a4 0x18aa3705c 0x18aa5c508 0x18aa5f294 0x18a7e60c0 0x18adea5d8 0x18adddcf8 0x18adddafc 0x18addddc4 0x18a7263e4 0x18a726360 0x18a70ec88 0x18a725c78 0x18a7258a8 0x18a71eadc 0x18a6efa2c 0x18a6edf18 0x1851505a4 0x185150038 0x18514dd38 0x18507cdc0 0x190518088 0x18a756f60 0x1000d56e4 0x19ae9e8b8)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

You probably have an outlet in your view that is connected to a label (SignUpLabel) in your class that is not found.
Either your File's owner is not set to be your ViewController or you have deleted/renamed the label in your class and need to reset the outlet in your view.
You also have an error with your constraints but that shouldn't contribute to the crash.

Related

Swift : how to check which view is causing constraints error

I am getting the following error when trying to load a VC:
Thread 1: Exception: "Unable to activate constraint with anchors
<NSLayoutXAxisAnchor:0x280fea300 \"i6.I6FuelSheetTextField:0x1030fe400.centerX\"> and
<NSLayoutXAxisAnchor:0x280fea440
\"UILayoutGuide:0x282327800'UIViewSafeAreaLayoutGuide'.centerX\"> because they have no common
ancestor. Does the constraint or its anchors reference items in different view hierarchies?
That's illegal."
How can I identify which views these addresses are referring to?
This is occurring because you are trying to constraint two views that are unrelated to each other. You are lucky enough to get enough information from the error. You are using a component that an instance of I6FuelSheetTextField and you trying to constraint it's centerX attribute. So, I think the error itself is pretty explanatory.
Note: It could also be the case when you forget to add a view to another view's subview.

Failed to set (borderWidth) user defined inspected property on (UIView): ....this class is not key value coding-compliant

I get the following error:
Failed to set (borderWidth) user defined inspected property on (UIView): [ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key borderWidth.
I looked over all the responses in StackOverflow and the most common solution is to find an unused outlet (!). This solution was useful in many cases but no such outlet exists this time.
Hope this can help as I spent a couple of hours on that. Typically you may have an abandoned outlet (marked by !). However, in my case, the problem was with a non-used "User Defined Runtime Attributes".
In the identity inspector, I had attributes that were associated with UIView but not connected to anything.
StackOverflow doesn't allow me to embed a picture yet but if you check the link (https://i.stack.imgur.com/N631n.png), The picture shows the correct attributes (note the 'custom view') at the top. The unused attributes were associated with UIView and once I deleted them, it resolved the issue.

Confused by conflicting autolayout constraints

I got this crashlog when I click on tabbar tabitem to change viewcontroller:
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:0xdb98e30 h=--- v=--- H:[UIWindow:0xc65c530(320)]>",
"<NSAutoresizingMaskLayoutConstraint:0xdbba9a0 h=-&- v=-&- UITransitionView:0xdb43ab0.width == UILayoutContainerView:0xdb42ef0.width>",
"<NSAutoresizingMaskLayoutConstraint:0xc680b80 h=-&- v=-&- UILayoutContainerView:0xdb42ef0.width == UIWindow:0xc65c530.width>",
"<NSAutoresizingMaskLayoutConstraint:0x119352f0 h=-&- v=-&- UIViewControllerWrapperView:0xc68a2c0.width == UITransitionView:0xdb43ab0.width>"
)
Will attempt to recover by breaking constraint
<NSAutoresizingMaskLayoutConstraint:0x119352f0 h=-&- v=-&- UIViewControllerWrapperView:0xc68a2c0.width == UITransitionView:0xdb43ab0.width>
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.
First, how are you applying these constraints? The most common cause of these conflict messages is adding constraints without ensuring they are the only ones the view has. Have you set the property
translatesAutoresizingMaskIntoConstraints = NO
before trying to set more? Because you are getting this exception at runtime it looks like Xcode has accepted what you are trying to do so you are probably adding constraints in code.
Did you add all of those constraints in the list that are given as conflicting? If so, remove them and replace them one by one to find which one you got wrong.
If you are doing all this in Xcode in what we used to know of as Interface Builder, use the new tools to examine all of the constraints and verify that you have not added constraints that conflict. Xcode can help you here.
If you are adding constraints in code but you have created the view in IB then you probably want to either manage all constraints in IB or you want to set the xib to NOT use autolayout, so that it does not apply constraints that conflict with what you later add.

"Unable to simultaneously satisfy constraints" error with UIScrollView

Created a simple ViewController, and added UIScrollView with a xib. When I'm trying to change the height of the scroll view, I'm getting a weird exception:
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) (
"",
"",
"",
"" )
Will attempt to recover by breaking constraint
(Names: '|':UIView:0xa4ab830 )>
Break on objc_exception_throw to catch this in the debugger. The
methods in the UIConstraintBasedLayoutDebugging category on UIView
listed in may also be helpful.
Here's how my xib looks:
Found on the SO that setting content size and setting translatesAutoresizingMaskIntoConstraints property to YES might help. Tried it, didn't work:
topScrollView.translatesAutoresizingMaskIntoConstraints = YES;
topScrollView.contentSize = CGSizeMake(1000, 2000);
EDIT: added screenshot

Iphone 'NSInvalidArgumentException', reason: '-[__NSCFSet setPolicyNumber:]

Hi i am a newbie to iPHone development and I am getting this error that states that the setter method cannot be found for a string variable despite that variable being declared with the #property and #synthesize declarations. The variable is contained within a seperate object to the class which I am attempting to set the value.
Any help would be appreciated.
here is the code relating to the error.
[reg setPolicyNumber:self.policyNoField.text];
[reg printSummaryToConsole];
debugger says that
-[__NSCFSet setPolicyNumber:]: unrecognized selector sent to instance 0x643fd80
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFSet setPolicyNumber:]: unrecognized selector sent to instance 0x643fd80'
I have allocated an initialized the Registration class (reg) in this class and I have the PolicyNumber created and synthesized in the registration class also. yet I am still getting this error.
Any help would be appreciated.
reg is a reference to an instance of NSCFSet.
Most likely, you failed to retain whatever reg was supposed to refer to in the first place and, coincidentally, an NSCFSet happened to be allocated where the old object was.
Use Build and Analyze, then use zombie detection if that doesn't identify the problem.