views:

57

answers:

1

I am trying to work on NSDocument, so I tried the Building a Text Editor in 15 Minutes example in the Text System Overview reference.

I did some changes to code which was suggested, such as used property and synthesize in place of declaring and defining accessor methods.

I followed each step written in the reference but could not implement step 5:

If it is not already open, double-click MyDocument.xib to open the document window in Interface Builder. From Xcode, drag the MyDocument.h file icon onto the document window of MyDocument.xib. This step informs the MyDocument.xib file that the MyDocument object interface now has an outlet variable named textView.

When I compiled, it gave me following warnings in subclass of NSDocument:

myDocument may not respond to setString

MyDocument window did not appear and this message in console appeared each time I tried to execute it:

-[MyDocument string]: unrecognized selector sent to instance 0x215970

Can anyone suggest me where I may be wrong? I am trying to run it on Snow Leopard... to check the code you can also download it from here.

A: 

I don't think step 5 is actually necessary in the current Xcode Tools because Interface Builder automatically picks up these changes when your header file is saved. I think this was added in Xcode Tools 3.

I haven't looked at your project but it sounds almost as if you have some outlets connected to the wrong things in your MyDocument.xib file. The big clues are that your MyDocument "doesn't respond to selector setString" ... the fact that this message is appearing means that's exactly what your project is trying to do. Given the subject of the guide you're using, it sounds like the -setString: message meant for your text view is being sent to your document (File's Owner in your MyDocument.xib).

Joshua Nozzi