Hello
First post on this board with a question relating to my first venture
into xcode, I have a little bit of programming experience on the
windows side, im new to macs as well so please go easy on me..
I have system 10.3.9 and am using xcode version 1.5, the question
relates the this o'reilly tutorial:
http://www.macdevcenter.com/pub/a/mac/2001/06/01/cocoa.html?page=2
If you didnt read it, it is a simple text editor using just an
NSTextView component and I am trying to give it the ability to
open/save files.
Basically upon compilling, I receive 5 errors in the MyDocument.m file,
each one a "error: parse error before "}" token" in the following code:
#import "MyDocument.h"
@implementation MyDocument
- (id)init
{
self = [super init];
if (self) {
// Add your subclass-specific initialization here.
// If an error occurs here, send a [self release] message and
return nil.
}
return self;
}
- (NSString *)windowNibName
{
// Override returning the nib file name of the document
// If you need to use a subclass of NSWindowController or if your
document supports multiple NSWindowControllers, you should remove this
method and override -makeWindowControllers instead.
return @"MyDocument";
}
- (void)windowControllerDidLoadNib:(NSWindowController *) aController
{
[super windowControllerDidLoadNib:aController];
if (fileData != nil)
{
[textView replaceCharactersInRange:NSMakeRange(0,0)
withRTFD:fileData];
}
}
- (NSData *)dataRepresentationOfType:(NSString *)aType
{
NSRange range = NSMakeRange(0, [[textView textStorage] length]);
return [textView RTFDFromRange:range];
}
- (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)aType
{
fileData = data;
return fileData != nil;
}
@end
All help appreciated
Chris
David Phillip Oster - 29 May 2006 20:39 GMT
> Hello
>
[quoted text clipped - 9 lines]
> NSTextView component and I am trying to give it the ability to
> open/save files.
You apparently didn't read the comments on that web page. The error you
describe is identical to one caused by a malformed MyDocument.h, as
discussed in 2004 on that page.
ChrisW - 30 May 2006 09:20 GMT
Aaaaah, I did actually read it, but rather stupidly left out adding a
semi-colon to one of the declarations, thanks for making me go and look
at it again and sorry if i wasted any time.
Cheers
Chris
Michael Ash - 30 May 2006 16:55 GMT
> Aaaaah, I did actually read it, but rather stupidly left out adding a
> semi-colon to one of the declarations, thanks for making me go and look
> at it again and sorry if i wasted any time.
Just for future reference, when trying to get help on an error it helps to
actually tell us where the error occurs. You already get ten points just
for telling us what it is, but where helps even more. Glad you got it
fixed.

Signature
Michael Ash
Rogue Amoeba Software