값이 오지 않는 NSMutableDictionary에이 문제가 있습니다. 해시에 다음Objective-C 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);
}
그래서 문제는 두 번째 주소가 인쇄되어 배열의 813에
// 데이터를 난 알아낼 수 없습니다 : 내 코드에서 조각은 다음과 같이 왜? 아무도 도움을 줄 수 있습니까?
@Laurent good catch! –
...... IMAO, 고마워! 초보자 실수. – user293313