Answer the question
In order to leave comments, you need to log in
Error when starting project in xCode 5 after connecting MessageUI?
I am learning to develop for iOs according to the book. I was doing a project, at some point I needed to connect MessageUI and the project stopped running. It builds successfully but does not run. I disable MessageUI and everything is fine again.
When running this error:
2013-11-19 23:34:10.464 UIPickerViewExample[28419:70b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key myPicker.
What can be wrong?
The project can be viewed here: https://github.com/pchelnikov/UIPickerViewCrashApp
Answer the question
In order to leave comments, you need to log in
You will not believe!
Banal renaming ViewController from MPViewController to, for example, BBViewController (context menu on the class declaration, Refactoring, Rename)
solves the problem. Why? Don't know?
Welcome to the harsh world of objective-c
You have a Picker binding in the storyboard to the property that you commented out in the controller, therefore, when you "unpack" the controller from there and try to assign this Picker object to this variable, you get this error. Here is the only strange thing, under what circumstances it climbs out. In general, the rule is that no left/dead links should stick out in the storyboard/xib. Here in the right panel myPicker just delete http://d.pr/i/7TVD
The code tag does not work in the comment, so I’ll write it here and it’s impossible to delete the comment (you can
reuse the code, there are 1-3 types of buttons in one project, so you make a class whose static methods build buttons, according to several parameters ... CGRect and let's say title and just put them immediately to the view you need and everywhere a call in 1 line of this static function. For example, like this:
+(UIButton*)greenButtonWithObject:(id)object andRect:(CGRect)rect fontSize:(float)size
{
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
UIImage *stretchBG = )
[button setImage:object forState:UIControlStateNormal];
else
{
[button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[button.titleLabel setFont:[UIFont fontWithName:@"HelveticaNeue-Bold" size:size]];
[button setTitle:object forState:UIControlStateNormal];
}
[button setBackgroundImage:stretchBG forState:UIControlStateNormal];
return button;
}
Looks like it's still an xCode glitch. Try as I might, it didn't work. At some point, the viewDidLoad method even stopped being called.
I talked with a friend who has been developing for a long time, he says that he uses IB only for Core Data, because, he says, the application stupidly crashes when using IB. Apparently, I have the same situation. :-)
I rewrote the application using a software picker and everything was ok.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question