1

i'm beginner with xcode and having some problems.Everything started when i created a xib file. I created xib file and connected to the View Controller.After that it crashed with error:"loaded the "Main" nib but the view outlet was not set." Then i right-clicked to the File's owner icon on the left menu and drag it View icon below.There is appeared a menu Outlets.And i clicked view.

I run again and this time another error appeared:"this class is not key value coding-compliant for the key view." I searched a lot on the net about this crash but none of them worked.Can anyone help me about this file's owner and xib stuff?

saidozcan
  • 2,115
  • 9
  • 27
  • 39
  • `I created xib file and connected to the View Controller` What you did with the default xib file? and Which View controller are you using? – Anoop Vaidya Dec 23 '12 at 15:25
  • I have a **ViewController and when i created xib file i went to Custom class menu on the right and typed there **ViewController – saidozcan Dec 23 '12 at 15:26
  • Dupe of http://stackoverflow.com/questions/4763519/loaded-nib-but-the-view-outlet-was-not-set-new-to-interfacebuilder. In future to prevent such problems, there's a checkbox when you create a view controller asking whether to create a XIB for it, if you select it then Xcode will create a XIB with the view outlets already set up. – Sherman Lo Dec 23 '12 at 15:29
  • i'll take your advice and recreaete the xibs with classes – saidozcan Dec 23 '12 at 15:33
  • You didn't post the full error message. You need to copy **all** of the output from the console window and paste it into your question. Don't summarize it and don't retype it. Copy and paste. – rob mayoff Dec 23 '12 at 15:35
  • You can find answer to this and all questions related to crashes here: http://www.raywenderlich.com/10209/my-app-crashed-now-what-part-1 – Andrey Chernukha Dec 23 '12 at 15:32

1 Answers1

0

Check your outlets in nib file. Then double check them. Then check if you have properly synthesized all of your properties. Then check if your file owner object in xib is set to the proper UIViewController. Then check if you have renamed any properties in your .h/.m file after setting their outlets in XIB.
Key value coding-compliant error usually occurs when you set the outlet of an object to a property that does not exist in .h/.m file.

Maggie
  • 7,823
  • 7
  • 45
  • 66
  • i did not add any outlet or property to the nib file.Just there is a empty nib file and errors. – saidozcan Dec 23 '12 at 15:27
  • I see in your previous comment that you have changed File's owner. Why? It should be set to the name of your UIViewController. – Maggie Dec 23 '12 at 15:30
  • Shouldn't be nib file connected to the it's class? – saidozcan Dec 23 '12 at 15:32
  • it should be connected to a UIViewController. Set the File's Owner to your UIViewController (MainViewController, or whatever it is that you called it) and then click on the View, and set its outlet to the File's Owner > View – Maggie Dec 23 '12 at 15:35
  • step 1: https://dl.dropbox.com/u/2482095/Screen%20Shot%202012-12-23%20at%204.36.52%20PM.png – Maggie Dec 23 '12 at 15:40
  • step 2: https://dl.dropbox.com/u/2482095/Screen%20Shot%202012-12-23%20at%204.37.43%20PM.png – Maggie Dec 23 '12 at 15:42
  • Then your File's Owner object is not set to the proper UIViewController – Maggie Dec 23 '12 at 15:44
  • Here's my project can you have a look please? http://bit.ly/UgTaDO Cos i think i did what you said – saidozcan Dec 23 '12 at 15:46
  • Did you have a look at the warnings when compiling your project? You have declared 'property (strong,nonatomic) MainViewController *viewController;' in your AppDelegate.h but you didn't synthesize it. Add: @synthesize viewController in your AppDelegate.m and do the same thing for window property – Maggie Dec 23 '12 at 16:13
  • And please have a look at my original answer. I explicitly said: "Then check if you have properly synthesized all of your properties." – Maggie Dec 23 '12 at 16:16
  • i'm sorry but i add synthesizes there is no change. – saidozcan Dec 23 '12 at 16:27