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

macindev

macrumors newbie
Original poster
Jul 6, 2009
14
0
Seattle, Washington, USA
Why am I getting this error message?

Code:
- (void)openWindow:(id)IBAction{
    [COLOR="Red"]error: syntax error before 'void'[/COLOR]
 [self.window makeKeyAndOrderFront:self];
}

FYI: This is inside the implementation.

I am trying to make a method for opening a window by selecting a menu item, but I am barely starting to learn Objective-C and I only know HTML...
 
Try:
Code:
- (IBAction)openWindow:(id)sender {
    [[self window] makeKeyAndOrderFront:nil];
}
 
Try:
Code:
- (IBAction)openWindow:(id)sender {
    [[self window] makeKeyAndOrderFront:nil];
}

Thanks, I tried that but am now getting a warning saying "'MyDocument' may not respond to '-window'". And, build fails with exit code 1 and says "duplicate symbol .objc_class_name_MyDocument"... :(


~ I do not know why this last part is happening, because I tried reverting the code back to a "working" state and I got the same error... strange... ~
 
Fixed it...

I finally figured out what was wrong, I made another class for a nib file called "Browser" but the methods were duplicates of what was in "MyDocument" and that was keeping it from building.
:cool:
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.