While writing an iPad application, I seem to be running into a lot of weird errors. Basically, I have a parent class "Ticker" that checks to see if stock ticker data is cached and if it isn't, it creates an instance of NetworkTickerData, passing itself as an argument and adding the returned data to itself.
Here is the code for [Ticker getData]
:
-(void)getData
{
// some check here to see if the data is locally cached
// if not
NetworkTickerData* tick = [[NetworkTickerData alloc] initWithTicker: self];
[tick getHistoricalTickerData];
self.tickerData = tick.tickerData;
}
and the code for [NetworkTickerData initWithTicker:]
:
+(NetworkTickerData*)initWithTicker: (Ticker*)tick
{
NSLog(@"Doing Setup");
NetworkTickerData* t = [[NetworkTickerData alloc] init];
t.ticker = tick;
t.net = [[NetworkOp alloc] init];
return t;
}
I am getting the error: *** -[NetworkTickerData initWithTicker:]: unrecognized selector sent to instance
Is there a problem passing the variable self
to initWithTicker
? For what its worth, the NSLog
, only there for debug purposes, never prints out.
If I had to guess, the problem must be with using self
, maybe it doesn't refer to the current class?