Reputation: 33
I am a student who is learning and working on an App for my school. I have just started and am doing okay. However, I am recieveing the error "Expected identifier or '(' ". I have spent a few days now reading posts and googleing, and no solution I have found is working for me.
I am trying to make a Round Rect Button on the second tab of my application to link to the school's website.
Here is the .h:
#import <UIKit/UIKit.h>
@interface SecondViewController : UIViewController {
}
- (IBAction)Website:(id)sender;
@end
and here is my .m with error commented:
#import "SecondViewController.h"
@interface SecondViewController ()
@end
@implementation SecondViewController
-(IBAction)Website {
[[UIApplication sharedApplication ] openURL:[NSURL URLWithString:@"http://www.google.com"]];
}
{ **// Error is on this line[23]**
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)Website;
- (IBAction)Website:(id)sender; {
}
@end
How can I fix this little guy? Thank you very much! Also, the .h file was formed by xCode, by simply control dragging from button, to .h and creating an action. Could this be the cause?
Upvotes: 3
Views: 5250
Reputation: 31745
I think you have accidentally deleted this line:
- (void)viewDidLoad
above this line
{ **// Error is on this line[23]**
but for simplicity you could delete this:
{ **// Error is on this line[23]**
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
as you are not using viewDidLoad for anything
Upvotes: 3