我正在iOS應用程序中下載並解析JSON訂閱源。 JSON訂閱源提供的某些數據部分在我的iOS應用程序中正確顯示,但JSON訂閱源的某些部分似乎返回「null」,即使在實際的JSON訂閱源本身中它們不包含數據「null」。iOS從JSON訂閱源返回「null」數據
這裏是我的代碼:
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];
JSON供稿我想負荷是這個:
:JSON的飼料,返回 「空」 是 http://api.wunderground.com/api/595007cb79ada1b1/conditions/q/CA/San_Francisco.json一部分
"full":"San Francisco, CA"
上面返回「null」....爲什麼?我該如何解決這個問題?
感謝,丹
「上面的返回」null「」 - 你上面的是一個關鍵值對。在什麼意義上它可以「返回null」(無論這意味着什麼)? – 2013-05-14 13:40:11
對不起,我的解釋差,我的意思是,當我嘗試通過我的iOS應用程序訪問「完整」包含的數據時,我的應用程序返回(顯示)字符串「null」而不是「San Francisco,CA」。 – Supertecnoboff 2013-05-14 13:41:49
你如何訪問數據? – 2013-05-14 13:43:37