値が表示されない NSMutableDictionary でこの問題が発生しています。私のコードのスニペットは次のようになります。
//データをハッシュに、次に配列に
yellowPages = [[NSMutableArray alloc] init];
NSMutableDictionary *address1=[[NSMutableDictionary alloc] init];
[address1 setObject:@"213 Pheasant CT" forKey: @"Street"];
[address1 setObject:@"NC" forKey: @"State"];
[address1 setObject:@"Wilmington" forKey: @"City"];
[address1 setObject:@"28403" forKey: @"Zip"];
[address1 setObject:@"Residential" forKey: @"Type"];
[yellowPages addObject:address1];
NSMutableDictionary *address2=[[NSMutableDictionary alloc] init];
[address1 setObject:@"812 Pheasant CT" forKey: @"Street"];
[address1 setObject:@"NC" forKey: @"State"];
[address1 setObject:@"Wilmington" forKey: @"City"];
[address1 setObject:@"28403" forKey: @"Zip"];
[address1 setObject:@"Residential" forKey: @"Type"];
[yellowPages addObject:address2];
//Iterate through array pulling the hash and insert into Location Object
for(int i=0; i<locationCount; i++){
NSMutableDictionary *anAddress=[theAddresses getYellowPageAddressByIndex:i];
//Set Data Members
Location *addressLocation=[[Location alloc] init];
addressLocation.Street=[anAddress objectForKey:@"Street"];
locations[i]=addressLocation;
NSLog(addressLocation.Street);
}
問題は、2 番目のアドレス (813) だけが表示されることで、その理由がわかりません。誰でも助けを提供できますか?