Helpful Addition to ABPerson
I hope I beat everyone else to the punchline (see here for reference). The original version of the code I posted didn't actually, you know... work. I spent a ridiculous amount of debugging it (labels are not identifiers!). Maybe this will actually help somebody who's building MotherFinder 1.0.@interface ABPerson (CanIBuyAVowel)
- (id)yoMomma;
@end
@implementation ABPerson (CanIBuyAVowel)
- (id)yoMomma
{
ABMultiValue * relatives;
relatives = [self valueForProperty:kABRelatedNamesProperty];
int i, count = [relatives count];
NSString * label = nil;
NSString * mother = nil;
for ( i = 0; i < count; i ++ )
{
label = [relatives labelAtIndex:i];
if ([label isEqualToString:kABMotherLabel])
{
mother = [relatives valueAtIndex:i];
break;
}
}
return mother;
}
@endBy the way, I like the signature for setMe in ABAddressBook.h.
- (void)setMe:(ABPerson *)moi;
// Sets "Me" to moi.
// Pass nil to clear "Me"If somebody does decide to make MotherFinder, please adorn the UI with some useless doily eyecandy or something.
Helpful Addition to ABPerson
Posted Nov 23, 2006 — 1 comments below
Posted Nov 23, 2006 — 1 comments below








Chris Forsythe — Nov 27, 06 2493
Chris