Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / May 2006



Tip: Looking for answers? Try searching our database.

error: parse error before "}" token (newbie needs help)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ChrisW - 29 May 2006 19:36 GMT
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

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.