0
我使用objectForKey
從xml
文件中獲取價值,但不是其失敗。這裏是xml
數據iOS-無法獲得價值
{
"__name" = root;
destination = CIVC;
message = {
"co2_emissions" = "<p>CO<sub>2</sub> emissions saved by this BART trip: <strong>9.8 pounds.</strong> <a href=\"http://www.bart.gov/guide/carbon.aspx\">Read more</a></p>";
legend = "bikeflag: 1 = bikes allowed. 0 = no bikes allowed. transfercode: blank = no transfer, N = normal transfer, T = timed transfer, connecting trains will wait up to five minutes for transferring passengers. S = scheduled transfer, connecting trains will not wait for transferring passengers if there is a delay.";
};
origin = ASHB;
"sched_num" = 34;
schedule = {
after = 2;
before = 2;
date = "Jan 6, 2014";
request = {
trip = (
{
"_clipper" = "1.40";
"_destTimeDate" = "01/06/2014";
"_destTimeMin" = "11:52 AM";
"_destination" = CIVC;
"_fare" = "3.75";
"_origTimeDate" = "01/06/2014 ";
"_origTimeMin" = "11:27 AM";
"_origin" = ASHB;
leg = {
"_bikeflag" = 1;
"_destTimeDate" = "01/06/2014";
"_destTimeMin" = "11:52 AM";
"_destination" = CIVC;
"_line" = "ROUTE 7";
"_order" = 1;
"_origTimeDate" = "01/06/2014";
"_origTimeMin" = "11:27 AM";
"_origin" = ASHB;
"_trainHeadStation" = MLBR;
"_trainIdx" = 29;
"_transfercode" = "";
};
},
和這裏的部分是我的代碼,以獲得origin
,destination
,sched_num
,date
,_destTimeDate origin
,destination
,sched_num
,date
做工精良只有
self.DepartLabel.text = [dic objectForKey:@"origin"];
self.ArriveLabel.text = [dic objectForKey:@"destination"];
self.SchednumLabel.text = [dic objectForKey:@"sched_num"];
self.DateLabel.text = [[dic objectForKey:@"schedule"] objectForKey:@"date"];
self.TimeLabel.text = [[[[dic objectForKey:@"schedule"] objectForKey:@"request"]objectForKey:@"trip"]objectForKey:@"_destTimeDate"];
的_destTimeDate
行的事工作。如何獲得這個值?
請注意,IOS是不一樣的iOS。 IOS代表http://en.wikipedia.org/wiki/Cisco_IOS,而iOS則代表http://en.wikipedia.org/wiki/IOS – Popeye