Hi,
I have a method which takes an ABPerson as an argument, in the method I extract some values from the ABPerson object and display them in text fields. For some reason, the only value that gets displayed is the "kABOrganizationProperty", none of the others show up. Additionally, I get a runtime error in this method that looks like this: --[ABMultiValue length]: selector not recognized. Below is my method where I am having trouble:
Any help would greatly appreciated.
//BEGIN CODE//
-(void)populateFields:(ABPerson *)person {
ABMultiValue *addrs = [person valueForProperty:kABAddressProperty];
NSString *primaryID = [addrs primaryIdentifier];
int idx = [addrs indexForIdentifier:primaryID];
NSDictionary *primaryAddr = [addrs valueAtIndex:idx];
//set city
if ([primaryAddr objectForKey:kABAddressCityKey]!=nil)
[clientCityField setStringValue:[primaryAddr objectForKey:kABAddressCityKey]];
//set street
if ([primaryAddr objectForKey:kABAddressStreetKey]!=nil)
[clientStreetField setStringValue: [primaryAddr objectForKey:kABAddressStreetKey]];
//set State
if ([primaryAddr objectForKey:kABAddressStateKey]!=nil)
[clientStateField setStringValue: [primaryAddr objectForKey:kABAddressStateKey]];
//set Zip code
if ([primaryAddr objectForKey:kABAddressZIPKey]!=nil)
[clientZipCodeField setStringValue: [primaryAddr objectForKey:kABAddressZIPKey]];
//set phone
if ([person valueForProperty:kABPhoneProperty]!=nil)
[clientPhoneField setStringValue: [person valueForProperty:kABPhoneProperty]];
//set email
if ([person valueForProperty:kABEmailProperty]!=nil)
[clientEmailField setStringValue: [person valueForProperty:kABEmailProperty]];
//set first name
if ([person valueForProperty:kABFirstNameProperty]!=nil)
[clientFirstNameField setStringValue: [person valueForProperty:kABFirstNameProperty]];
//set last name
if ([person valueForProperty:kABAddressProperty]!=nil)
[clientLastNameField setStringValue: [person valueForProperty:kABAddressProperty]];//set company name
if([person valueForProperty:kABOrganizationProperty]!=nil)
[clientCompanyField setStringValue:[person valueForProperty:
kABOrganizationProperty]];
}