I am making iPad application, in which, I am fetching data from a URL. Sometimes, I retrieved Null instead.
In my URL i am passing my id dynamically, for eg: in this code i passed id = PNB,
here is the code snippet:
NSMutableString*str;
NSString *urlAddress = @”http://ipad.idealake.com/stockquote.aspx?id=PNB”;
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webView loadRequest:requestObj];
str=[NSMutableString alloc] initWithContentsOfURL:url]; //(here compiler shows me warning initWithContentsOfURL is deprected)
NSLog(@"str=%@",str);
When I do NSLog of str, it shows me null value,
output: str=null
However, when I pass id=SUNPHARMA or id=AMBUJA it shows me proper output but when i pass id=TCS or id=LT it again shows me null value in my str. What went wrong?