Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Monaj

macrumors regular
Original poster
May 24, 2009
193
0
Hi all,

I am trying to work on NSDocument, so I tried a simple code provided from this link- http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/TextArchitecture/Tasks/TextEditor.html#//apple_ref/doc/uid/20001798

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 this 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- http://www.mediafire.com/?2dgjwmrzt5q

Thanks,

Monaj
 
The original code implemented setString: and string accessor methods. You changed it to a property, and gave the property the name mString, so you should use setMString and mString as the accessor methods, but since you're using a property you should lose the "m" prefix. So basically rename your "mString" to "string" and it should work.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.