5

I'm currently learning how to code for iPhone though the Beginning iPhone 4 development book by Jeff LaMarche but have come across a problem that I cannot seem to see where the problem lies. I have read on many forums saying that this is a problem with IBOutlets not being connected correctly but I have tried it many times and the problem does not go away so I'm here asking for help.

Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x4b3c2a0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key datePicker.'
Hong Yi
  • 569
  • 2
  • 13
  • 29

1 Answers1

9

Open your nib file and check whether datepicker outlet is connected to your UIDatepicker .This problem arises when referncing outlet not set.

Please follow this steps 1. Open your MainWindow nib. 2. Select DataPickerViewController. 3. Change Its Class(Alt+4) to DataPickerViewController (Currently it's UIViewController). 4.Save the Nib and run, will work.

itZme
  • 1,439
  • 9
  • 14
  • thanks, that solved my problem. had a hard time figuring that out. – Hong Yi May 09 '11 at 05:33
  • 1
    Also note that the simulator tends to cache XIBs. If you find that you don't have any problematic outlets, try deleting the app from the sim and running again. – memmons Feb 13 '12 at 21:55