Reputation: 4247
Following this tutorial I wrotte this code:
NSData* json = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://api.fessor.da.stanids.office/homework/index/?rp[token]=app&rp[workspace]=parent&child_id=22066&type=parent&start_date=2014-05-01&end_date=2014-05-01"]];
NSLog([NSString stringWithFormat:@"%@",json]);
But i get nil when i log the result. Can anybody tell me if this tutorial is simply bad or I am doing something wrong somewhere?
P.S. I am calling this code in viewDidLoad.
Upvotes: 0
Views: 168
Reputation: 5081
NSData* json = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://api.fessor.da.stanids.office/homework/index/?rp[token]=app&rp[workspace]=parent&child_id=22066&type=parent&start_date=2014-05-01&end_date=2014-05-01"]];
NSDictionary * dictData = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
Try with this..
Upvotes: 1
Reputation: 4371
It is because your url is not available or something wrong. Try to use another url like : http://www.bbc.co.uk/radio4/programmes/schedules/fm/today.json
It should work.
Upvotes: 1