Iphone 快速枚举会干扰我的文本输出吗?

Iphone 快速枚举会干扰我的文本输出吗?,iphone,objective-c,fast-enumeration,Iphone,Objective C,Fast Enumeration,在这里,我正在迭代NSDictionary对象数组(在优秀的MapQuest directions API解析的JSON响应中)。我想建立一个HTML字符串以放入UIWebView 我的密码是: for (NSDictionary *leg in legs ) { NSString *thisLeg = [NSString stringWithFormat:@"<br>%@ - %@", [leg valueForKey:@"narrative"], [leg valueFo

在这里,我正在迭代NSDictionary对象数组(在优秀的MapQuest directions API解析的JSON响应中)。我想建立一个HTML字符串以放入UIWebView

我的密码是:

for (NSDictionary *leg in legs ) {
    NSString *thisLeg = [NSString stringWithFormat:@"<br>%@ - %@", [leg valueForKey:@"narrative"], [leg valueForKey:@"distance"]];
    NSLog(@"This leg's string is %@", thisLeg);
    [directionsOutput appendString:thisLeg];
}
[leg valueForKey:@“叙述性”]
似乎返回一个字符串数组,而
[leg valueForKey:@“距离”]
返回一个NSNumbers数组。
legs
中只有一个对象

不过,我不明白为什么在发布的输出中缺少“


快速枚举对您的输出没有任何影响。

您怎么会认为这是由于快速枚举造成的?字典中的值看起来只是数组。事实证明你完全正确,这不是我所期望的,这让它看起来像是在for-loop中发生了非常神奇的事情。是的,完全正确。结果是
[leg valueForKey:@“叙述性”]
返回了我期望嵌套在另一个数组中的数组。
This leg's string is (
    "Start out going NORTH on INFINITE LOOP.",
    "Turn LEFT to stay on INFINITE LOOP.",
    "Turn RIGHT onto N DE ANZA BLVD.",
    "Merge onto I-280 S toward SAN JOSE.",
    "Merge onto CA-87 S via EXIT 3A.",
    "Take the exit on the LEFT.",
    "Merge onto CA-85 S via EXIT 1A on the LEFT toward GILROY.",
    "Merge onto US-101 S via EXIT 1A on the LEFT toward LOS ANGELES.",
    "Take the CA-152 E/10TH ST exit, EXIT 356.",
    "Turn LEFT onto CA-152/E 10TH ST/PACHECO PASS HWY. Continue to follow CA-152/PACHECO PASS HWY.",
    "Turn SLIGHT RIGHT.",
    "Turn SLIGHT RIGHT onto PACHECO PASS HWY/CA-152 E. Continue to follow CA-152 E.",
    "Merge onto I-5 S toward LOS ANGELES.",
    "Take the CA-46 exit, EXIT 278, toward LOST HILLS/WASCO.",
    "Turn LEFT onto CA-46/PASO ROBLES HWY. Continue to follow CA-46.",
    "Merge onto CA-99 S toward BAKERSFIELD.",
    "Merge onto CA-58 E via EXIT 24 toward TEHACHAPI/MOJAVE.",
    "Merge onto I-15 N via the exit on the LEFT toward I-40/LAS VEGAS.",
    "Keep RIGHT to take I-40 E via EXIT 140A toward NEEDLES (Passing through ARIZONA, NEW MEXICO, TEXAS, OKLAHOMA, and ARKANSAS, then crossing into TENNESSEE).",
    "Merge onto I-40 E via EXIT 12C on the LEFT toward NASHVILLE (Crossing into NORTH CAROLINA).",
    "Merge onto I-40 BR E/US-421 S via EXIT 188 on the LEFT toward WINSTON-SALEM.",
    "Take the CLOVERDALE AVE exit, EXIT 4.",
    "Turn LEFT onto CLOVERDALE AVE SW.",
    "Turn SLIGHT LEFT onto N HAWTHORNE RD.",
    "Turn RIGHT onto W NORTHWEST BLVD.",
    "1047 W NORTHWEST BLVD is on the LEFT."
) - (
    0.0020000000949949026,
    0.07800000160932541,
    0.14000000059604645,
    7.827000141143799,
    5.0329999923706055,
    0.15299999713897705,
    5.050000190734863,
    20.871000289916992,
    0.3050000071525574,
    2.802999973297119,
    0.10199999809265137,
    37.78000259399414,
    124.50700378417969,
    0.3970000147819519,
    25.264001846313477,
    20.475000381469727,
    125.8580093383789,
    4.538000106811523,
    1693.0350341796875,
    628.8970336914062,
    3.7990000247955322,
    0.19099999964237213,
    0.4099999964237213,
    0.257999986410141,
    0.5170000195503235,
    0
)