Here is my current code:
int i = 1;
NSString * StockOneYahooFinance = [NSString stringWithFormat:@"http://finance.yahoo.com/q/hp?s=S+Historical+Prices"];
NSString * PulledStockOne = [NSString stringWithContentsOfURL:[NSURL URLWithString:StockOneYahooFinance] encoding:1 error:nil];
for (i=1;i=30;i++){
NSString *StartPulling = [[PulledStockOne componentsSeparatedByString:@"nowrap align="] objectAtIndex:i];
NSString *StartOpen = [[StartPulling componentsSeparatedByString:@">"] objectAtIndex:3];
NSString *Open = [[StartOpen componentsSeparatedByString:@"<"] objectAtIndex:0];
NSString *StartClose = [[StartPulling componentsSeparatedByString:@">"] objectAtIndex:9];
NSString *Close = [[StartClose componentsSeparatedByString:@"<"] objectAtIndex:0];
year.text = Close;
i++;
}
But to the point I click the only button on the screen and it does exactly what I want it pulls the stocks open and close price for the day. But my current issue is I want it to pull all of these as an array so how can I do this?
First thing:
it should be:
Second one, do not increment ‘int i’ value on the end of loop because ‘for’ loop already do this. For quick’n dirty way of debugging add:
as the first function in ‘for’ loop to see what’s happening there.