views:

68

answers:

1

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
+1  A: 

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];
}
Ben Gottlieb
whew, thanks a lot - great :-)
michbeck
michbeck don't forget to mark the question answered (if indeed it is). Click the checkmark under the votes display to the left of the answer.
wkw