У меня есть NSMutableDictionary
с тремя парами ключ / значение.
key1 - person object1
key2 - person object2
key3 - person object3
Сравнивая строку с ключом в словаре, мне нужно получить содержимое объекта person.Как я могу это сделать?Пожалуйста, помогите мне.Мой код:
NSArray *keys = [persondict allKeys];
id key;
for(int i= 0; i<[keys count]; ++i)
{ key = [keys objectAtIndex:i];
}
for(id key in persondict){
if ([key isEqual:agentrefattr]){
//how to get the person object here?
[aperson setPhoneNumber:aperson.PhoneNumber];
[aperson setEmailAddress:aperson.EmailAddress];
[aPersonName setGivenName:aPersonName.GivenName];
[aPersonName setSurname:aPersonName.Surname];
[aperson setPersonName:aperson.PersonName];
[self.agentarray insertObject:aperson atIndex:index];
[self.agentnamearray insertObject:aPersonName atIndex:index];
aperson = [agentarray objectAtIndex:index];
aPersonName = [agentnamearray objectAtIndex:index];
NSLog(@"att:%@",agentrefattr);
NSLog(@"Email :%@",aperson.EmailAddress);
NSLog(@"Phone :%@",aperson.PhoneNumber);
NSLog(@"Given Name :%@",aperson.PersonName.GivenName);
NSLog(@"SurName :%@",aperson.PersonName.Surname);
Пожалуйста, помогите мне с некоторыми советами.Я хочу получить доступ к свойствам GivenName
, Surname
и т. Д. В объекте person.