When i test my code via Analyzer then got:
Instance variable used while 'self' is not set to the result of [(super or self) init…]
My code:
self = [super init];//initWithFrame:frame];
if (self)
{
tickerSymbol = [object valueForKey:@"TickerSymbol"];
url = [object valueForKey:@"URL"];
rssFeed = [object valueForKey:@"RSSFeed"];
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"ClientInfoView"
owner:nil
options:nil];
for (id currentObject in topLevelObjects)
{
if ([currentObject isKindOfClass:[ClientInfoView class]])
{
self = (ClientInfoView *)currentObject;
break;
}
}
[self.clientNameLabel setText:[clientObject valueForKey:@"Name"]];
[self.symbolLabel setText:[object valueForKey:@"TickerSymbol"]];
//[self loadHistoricalInfo];
self.getStock = [GetStockValue stockValueWithDelegate:self];
[self loadInfo:object clientObject:clientObject];
[self layoutLabels];
}
return self;
self = (ClientInfoView *)currentObject;
That doesn't make any sense. You should never be re-assigning self
save for to the result of [super init...]
(and in the case of some advanced techniques, which this isn't).
You should also never need to grub through the IB file like that. Create an outlet and make a connection, then use the outlet directly in your code.
Note that, in general, you shouldn't load interface in init
methods.