-4

I am getting an error in Xcode when adding some labelLoading code in the .m file. Hoping someone can help me out and point out the error in the code. Don't beat me up too bad as I am learning. I just can't get past this error.

@interface ViewController ()

@end

@implementation ViewController
@synthesize viewWeb;
@synthesize labelLoading;
@synthesize tqwWeb;
@synthesize blogWeb;
@synthesize eventsWeb;
@synthesize resWeb;
@synthesize homeWeb;

- (void)viewDidLoad

{
  [viewWeb setDelegate:self];
}

- (void)webViewDidStartLoad:(UIWebView *)webView {
    [labelLoading setHidden:NO];
}

- (void)webViewDidFinishLoad:(UIWebView *)webView {
    [labelLoading setHidden:YES];
}


{      **This is where the error Expected identifier or "(" occurs**

[super viewDidLoad];

    NSString *fullURL = @"http://www.rtics.com/DC1/";
    NSURL *url = [NSURL URLWithString:fullURL];
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
    [viewWeb loadRequest:requestObj];

[super viewDidLoad];

    NSString *afullURL = @"http://www.rtics.com/DC2";
    NSURL *aurl = [NSURL URLWithString:afullURL];
    NSURLRequest *arequestObj = [NSURLRequest requestWithURL:aurl];
    [tqwWeb loadRequest:arequestObj];


[super viewDidLoad];

    NSString *bfullURL = @"http:/www.rtics.com/DC3/";
    NSURL *burl = [NSURL URLWithString:bfullURL];
    NSURLRequest *brequestObj = [NSURLRequest requestWithURL:burl];
    [blogWeb loadRequest:brequestObj];

[super viewDidLoad];

    NSString *cfullURL = @"https://www.rtics.com/DC4";
    NSURL *curl = [NSURL URLWithString:cfullURL];
    NSURLRequest *crequestObj = [NSURLRequest requestWithURL:curl];
    [eventsWeb loadRequest:crequestObj];

[super viewDidLoad];

    NSString *dfullURL = @"http://www.rtics.com/DC5";
    NSURL *durl = [NSURL URLWithString:dfullURL];
    NSURLRequest *drequestObj = [NSURLRequest requestWithURL:durl];
    [resWeb loadRequest:drequestObj];

[super viewDidLoad];

    NSString *efullURL = @"http://www.rtics.com/";
    NSURL *eurl = [NSURL URLWithString:efullURL];
    NSURLRequest *erequestObj = [NSURLRequest requestWithURL:eurl];
    [homeWeb loadRequest:erequestObj];
}

- (void)viewDidUnload
{
    [self setViewWeb:nil];
    [self setLabelLoading:nil];
    [self setWebView:nil];
    [super viewDidUnload];


}
- (BOOL)shouldAutorotateToInterfaceOrientation(UIInterfaceOrientation)interfaceOrientation
{
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
    } else {
        return YES;
    }
}

@end
2
  • That's because you've added the contents of viewDidLoad's implementation, without ever adding the method. Also, why are you calling super so many times? Commented Sep 13, 2013 at 22:29
  • It looks like you've got some copy/paste issues or you've got something seriously wrong with your viewDidLoad method. You should only call [super viewDidLoad] once from viewDidLoad
    – Aaron
    Commented Sep 13, 2013 at 22:30

1 Answer 1

0

The line before your error should have - (void)viewDidLoad and you should only call [super viewDidLoad] once. Move anything in your other viewDidLoad to this new method and delete your other viewDidLoad.

For example:

- (void)viewDidLoad
{      **This is where the error Expected identifier or "(" occurs**

    [super viewDidLoad];

    [viewWeb setDelegate:self];  // Moved from previous viewDidLoad method

    NSString *fullURL = @"http://www.rtics.com/DC1/";
    NSURL *url = [NSURL URLWithString:fullURL];
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
    [viewWeb loadRequest:requestObj];

    NSString *afullURL = @"http://www.rtics.com/DC2";
    NSURL *aurl = [NSURL URLWithString:afullURL];
    NSURLRequest *arequestObj = [NSURLRequest requestWithURL:aurl];
    [tqwWeb loadRequest:arequestObj];

    NSString *bfullURL = @"http:/www.rtics.com/DC3/";
    NSURL *burl = [NSURL URLWithString:bfullURL];
    NSURLRequest *brequestObj = [NSURLRequest requestWithURL:burl];
    [blogWeb loadRequest:brequestObj];

    NSString *cfullURL = @"https://www.rtics.com/DC4";
    NSURL *curl = [NSURL URLWithString:cfullURL];
    NSURLRequest *crequestObj = [NSURLRequest requestWithURL:curl];
    [eventsWeb loadRequest:crequestObj];

    NSString *dfullURL = @"http://www.rtics.com/DC5";
    NSURL *durl = [NSURL URLWithString:dfullURL];
    NSURLRequest *drequestObj = [NSURLRequest requestWithURL:durl];
    [resWeb loadRequest:drequestObj];

    NSString *efullURL = @"http://www.rtics.com/";
    NSURL *eurl = [NSURL URLWithString:efullURL];
    NSURLRequest *erequestObj = [NSURLRequest requestWithURL:eurl];
    [homeWeb loadRequest:erequestObj];
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.