Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No visible @interface declares the selector error [closed]

I have a connection class in my project. I want to use this class in for a lot of works. When I tried to call this class's function getting following error : No visible @interface declares the selector error

coreConnection.h

@interface coreConnection:NSArray
{
    NSData *returnData;
}
      -(NSArray*)getData;
@end

coreConnection.m

#import "coreConnection.h"

@implementation coreConnection

-(NSArray*)getData:(NSString*)link
{
    NSOperationQueue *apiCallsQueue = [[NSOperationQueue alloc] init];
    NSURL *URL = [NSURL URLWithString:link];
    NSURLRequest *request = [NSURLRequest requestWithURL:URL];
    [NSURLConnection sendAsynchronousRequest:request queue:apiCallsQueue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
        dispatch_async(dispatch_get_main_queue(), ^{
            returnData = data;
        });
    }];
    return [NSJSONSerialization JSONObjectWithData:returnData options:nil error:nil];
}
@end

viewController.m

#import "coreConnection.h"

- (void)viewDidLoad
{
    [[self headlineCollectionView]setDelegate:self];
    [[self headlineCollectionView]setDataSource:self];
     [self.headlineCollectionView registerNib:[UINib nibWithNibName:@"HeadLineCell" bundle:nil] forCellWithReuseIdentifier:@"CELL"];
    coreConnection speed=[[coreConnection alloc] init];;
    headline = [speed getData:@"string"];
    [self.headlineCollectionView reloadData];
[super viewDidLoad];
}
like image 539
Sezgin Avatar asked Jul 09 '13 08:07

Sezgin


1 Answers

Hehe the problem is pretty simple your method in implementation and used in code is

-(NSArray*)getData:(NSString*)link

not

-(NSArray*)getData;

which is declared in .h file so make the declaration as

-(NSArray*)getData:(NSString*)link;

in .h file

EDIT

You also missed * in allocing the object

Use

coreConnection *speed=[[coreConnection alloc] init];;
like image 56
Lithu T.V Avatar answered Oct 12 '22 23:10

Lithu T.V