michbeck
michbeck

Reputation: 194

problem loading url in view

i'm confused about an error while i'm trying an url in a view. while compiling i get the following 2 errors (in h-file an in m-file):

Expected identifier before '*' token

maybe anybody can help me out of my trouble? thanks in advance!

my code:

File "RssWebViewController.h":


#import "RssWebViewController.h"

- (void)NavigateToUrl:(NSString) *url{
    NSURL *requestUrl = [NSURL URLWithString:self.url];
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
    [webView loadRequest:requestObj] 
}

File "RssWebViewController.h":

#import <UIKit/UIKit.h>


@interface RssWebViewController : UIView {
    UIWebView *WebView;
}

@property  (nonatomic, retain) IBOutlet UIWebView *WebView;

- (void) NavigateToUrl:(NSString) *url;

@end

Upvotes: 0

Views: 174

Answers (1)

Ben Gottlieb
Ben Gottlieb

Reputation: 85542

You need to structure your function definition with the * inside the parentheses:

- (void) NavigateToUrl: (NSString *) url;

It seems that you're referencing self.url, but really should be looking at url (no self.)

Here's a clearer version of the method:

- (void) NavigateToUrl: (NSString *) url {
    NSURLRequest     *request = [NSURLRequest requestWithURL: [NSURL URLWithString: url]];
    [self.WebView loadRequest: request];
}

Upvotes: 1

Related Questions