fredley
fredley

Reputation: 33871

Why can't I set a referencing outlet for my NSTextView in XCode 4?

I'm making a simple dialog in XCode 4 using the Interface Builder. I have three NSButtons, all of which are hooked up to their relevant IBOutlets. However I have an NSTextView, which I'd also like to hook up. I have the declaration for it in MyDialog.h:

@interface MyDialog : NibLoaderOC {
@public
  IBOutlet NSTextView* tv;
  IBOutlet NSButton* acceptButton;
  IBOutlet NSButton* editButton;
  IBOutlet NSButton* rejectButton;
}
@end

But when I drag the 'New Referencing Outlet' line over tv, it won't highlight. If I try and make a new outlet, it says:

Could not insert new outlet connection: Could not find any information for the class named MyDialog

I have tried restarting XCode, this does nothing. What am I doing wrong?

Upvotes: 4

Views: 7628

Answers (4)

Ish
Ish

Reputation: 1895

Another thing to check for is to make sure that if you have a custom class that you specify it under "Custom class" in the Identity inspector of Interface Builder.

So for instance if you have the following declaration

@interface MyViewController : UIViewController {
@public
  IBOutlet MyCustomView* aCustomView;

}
@end

Make sure you add that into the inspector as pictured. Otherwise I've found that you won't be able to hook it up.

Inspector view

Upvotes: 1

Ben H
Ben H

Reputation: 3905

i got this bug in xcode 4.6.0. restarting xcode didn't fix it for me. deleting the derived data for the project, then restarting xcode did fix it.

delete /Users/myusername/Library/Developer/Xcode/DerivedData/MyProject

Upvotes: 1

A.S.
A.S.

Reputation: 320

I noticed that .m file was moved inside en.lproj folder.

Just delete (reference only) the .m file from the Xcode and moved .m out of the en.lproj. Add it again.It will fix the issue.

Don't worry, you will get all your connections back.

Upvotes: 3

fredley
fredley

Reputation: 33871

Although I'd still be interested in a proper solution, I fixed this by just manually editing the xib code to create the link.

This has the unfortunate side-effect of Interface Editor refusing to play nicely with the file (although all my manual edits were correct, and the code compiles and runs perfectly).

Upvotes: 1

Related Questions