this class is not key value coding-compliant for the key view - objective-c

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?

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.

Related

Main.storyboard: warning: Unsupported Configuration

Hello I have this warning.
how can I solved this ?
Main.storyboard: warning: Unsupported Configuration: Scene is unreachable due to lack of entry points and does not have an identifier for runtime access via -instantiateViewControllerWithIdentifier:.
In the Storyboard, select the view controller you want to load when the app launches, and make sure to select the "Is Initial View Controller" checkbox on the right.
This warning is comes up if an unconnected view controller exists in a scene. In the image below for example I have disconnected a segue from the button to the small view controller below it to cause the warning. During development this can be ignored as long as you keep track of the VCs you disconnected.
In the image below the warning is gone because the small view controller is now "connected" via segue.
for some more information:
Any project consists of two classes, AppDelegate and ViewController.
If you open AppDelegate class you can see UIApplicationMain.
The #UIApplicationMain attribute at the top of the file designates the AppDelegate class as the entry point for the module.It is a requirement for using storyboards that your application delegate inherits from UIResponder and that it has a UIWindow property.
it is done in info.plist.
“Main storyboard file base name” specify the name of the storyboard that must be loaded when the app starts.
The arrow pointing at the view controller from the left indicates that it is the initial view controller to be displayed for this storyboard.
sometimes when you build you get error like "failed to load: entry point not set". it is clear that you not set an entry point, meaning you not set initial view controller to load.
To fix this just open Attribute inspector. Check the box : is initial view controller.
Even you can verify for some more details:
https://www.raywenderlich.com/113388/storyboards-tutorial-in-ios-9-part-1

Xcode 6.1 cannot drag connection to a property from XIB

I've just started with Xcode and I'm having a certain difficulty. I've placed a label on the canvas, declared property in viewcontroller.m, and now I'm trying to draw a connection into it, but it doesn't seem to exist. What am I doing wrong ?
I've added a screenshot - the property is not on the list for some reason, as you can see.
Using Xcode 6.1!
http://i.imgur.com/xYfoCnh.png
Select your view in your xib file and then click on File's Owner here:
With File's Owner selected, then open the identity inspector and make sure the class of File's Owner is ViewController like so:
Once you set the class of File's Owner to ViewController, you should see the UILabel property appear in the Connections Inspector for File's Owner.
Also, just for reference, the File's Owner for a view in a Xib file typically refers to the view controller (the view controller owns its view).

Xcode: NSCollectionViewItem does not have an outlet named imageView or textField

I would like to link an imageView and a textField in my xib grafical user interface to the belonging Outlets from the NSCollectionViewItem (which is an element from the application kit). But while linking the bindings following message pops up:
"Xcode cannont find a Key Value Coding compliant property named #property (assign) IBOutlet NSImageView *imageView NS_AVAILABLE_MAC(10_7); in the class NSCollectionViewItem."
So, for me it is not possible to connect these objects. Therefore I don't get any Referencing Outlets for the Text Field or the Image View.
In an another xib the same bindings exist already. But they are marked with a white exclamation point and also show up a strange message: "NSCollectionViewItem does not have an outlet named imageView."
Does anyone knows how to solve the problem? Would be great.
I just tested this and can confirm, regardless of the NIB's deployment target. It seems like an Xcode bug.
I created a custom subclass of NSCollectionViewItem with no actual customizations. I set the class of the collection view item in the NIB to my custom subclass and the outlets were suddenly available. I then set the class back and they were still available. I connected one and built and got no warnings or errors.

NSViewController and bindings

In my application I have a single nib file. The File's Owner is a NSViewController and insider there is just a vertical slider that I want to bind to a property in one of my classes. (I don't have any other nib files since it is a status bar application, so I don't have a window). The nib is loaded runtime to create a custom view for a NSMenuItem.
The problem is that I want to use an object controller to do the binding but I'm not sure what is the content of the object controller. How can I access from the nib to an arbitrary class in my project?
In the examples I have seen, usually the object controller uses the File's Owner to access the class (and the property for the binding) setting the Content Object binding to the File's Owner. But in my case from the File's Owner I do not have access to the class.
Any pointer?
Ok this works for me. It is enough subclassing NSViewController and sets the new subclass as the File's Owner. Now it is possible to use a Controller Object to bind through the File's Owner.
If you use XCode 4 you can Control-drag from the slider to the .h file (AppController.h?), and you will get the option to generate an outlet or an action. If you want to create an action, caused by sliding the slider, you should select action. The generated method will be called whenever the slider is changed. If you want the slider value to react to an event (or a changed instance variable in your program), set it to 'outlet'.
Hope that helps, let me know if you were really looking for something else :-)

Iphone : what do I need to do to a nib file to an exisitng object

I have tried using an outlet to connect my tableview controller to my object, setting the nib name in IB and setting the class in IB but it still wont link? I know this as im trying to set my table view to 'grouped'
Thanks very much.
It's a little unclear what the problem is. Do you have the outlet visible in IB, but it's not letting you draw a little line to the table view? In that case, double check the class of the outlet. It should be the same (or a superclass of) what you're trying to hook up to it.