単純なhttpリクエストメソッドを作成しようとしていますが、コンピング時に次のエラーが発生します。
Compiling file main.m ...
In file included from main.m:1:
./HttpManager.h:4:2: error: expected selector for Objective-C method
-<NSURL*> getUrlContent:(NSString) url;
~^
main.m:11:17: warning: instance method '-getUrlContent:' not found (return type defaults to 'id')
NSURL *myURL = [pHttpManager getUrlContent:@"http://www.cnn.com"];
私の簡単なソースコード:
HttpManager.h
#import <Foundation/Foundation.h>
@interface HttpManager:NSObject
-<NSURL*> getUrlContent:(NSString) url;
@end
HttpManager.m
#import "HttpManager.h"
@implementation HttpManager
-<NSURL*> getUrlContent:(NSString) url
{
NSURL *myURL = [NSURL URLWithString:url];
return myURL;
}
#end
main.m
#import "HttpManager.h"
#import <Foundation/Foundation.h>
int main(int argc,char** argv)
{
HttpManager* pHttpManager;
pHttpManager = [[HttpManager alloc] init];
NSURL *myURL = [pHttpManager getUrlContent:@"http://www.example_site.com"];
NSString *myHomePage = [NSString stringWithContentsOfURL: myURL
encoding: NSASCIIStringEncoding error: NULL];
NSLog(@"%@", myHomePage);
return 0;
}
私はここで何が間違っているのですか?