objective c - iOS returns "null" data from JSON feed -
i downloading , parsing json feed in ios application. parts of data json feed provides shown correctly in ios application, parts of json feed seem return "null" though in actual json feed itself, not contain data "null".
here code:
nserror *myerror = nil; nsdictionary *res = [nsjsonserialization jsonobjectwithdata:responsedata options:nsjsonreadingmutableleaves error:&myerror]; nsarray *results = [res objectforkey:@"current_observation"]; nsarray *cur = [results valueforkey:@"weather"]; nsarray *loc = [results valueforkey:@"full"]; nsarray *tmp = [results valueforkey:tmptype];
the json feed trying load one: http://api.wunderground.com/api/595007cb79ada1b1/conditions/q/ca/san_francisco.json
one part of json feed returns "null" is:
"full":"san francisco, ca"
the above returns "null".... why? , how go fixing issue?
thanks, dan
you need
nsstring *full= [[results valueforkey:@"display_location"] valueforkey:@"full"]];
because nested json.
Comments
Post a Comment