Accessing AB email values
Accessing AB email values
- Subject: Accessing AB email values
- From: Chewtoy <email@hidden>
- Date: Sun, 23 Nov 2003 13:55:02 -0800
ok so i'm attempting to access the email address values via the AB
Framework
here's my code:
ABMultiValue *email = [person valueForProperty:kABEmailProperty];
if (![email count] == 0) {
if (![email indexForIdentifier:kABEmailHomeLabel] ==
NSNotFound) {
NSString *workAddress = [[email valueAtIndex:[email
indexForIdentifier:kABEmailHomeLabel]] mutableCopy];
NSMutableDictionary *attribs = [NSMutableDictionary dictionary];
[attribs setObject:[NSColor colorWithCalibratedRed:0.610
green:0.610 blue:0.610 alpha:1.0]
forKey:NSForegroundColorAttributeName];
aStr = [[NSMutableAttributedString alloc]
initWithString:@"(work)" attributes:attribs];
[mDict setObject:[NSString stringWithFormat:@"%@
%@",homeAddress,aStr] forKey:@"email"];
[aStr release];
}
if (![email indexForIdentifier:kABEmailWorkLabel] == NSNotFound) {
NSString *homeAddress = [[email valueAtIndex:[email
indexForIdentifier: kABEmailWorkLabel]] mutableCopy];
NSMutableDictionary *attribs = [NSMutableDictionary
dictionary];
[attribs setObject:[NSColor colorWithCalibratedRed:0.610
green:0.610 blue:0.610 alpha:1.0]
forKey:NSForegroundColorAttributeName];
aStr = [[NSMutableAttributedString alloc]
initWithString:@"(work)" attributes:attribs];
[mDict setObject: [NSString stringWithFormat:@"%@
%@",homeAddress,aStr] forKey:@"email"];
[aStr release];
}
} else {
NSMutableDictionary *attribs = [NSMutableDictionary dictionary];
[attribs setObject:[NSColor colorWithCalibratedRed:0.610 green:0.610
blue:0.610 alpha:1.0] forKey:NSForegroundColorAttributeName];
aStr = [[NSMutableAttributedString alloc] initWithString:@"no
address" attributes:attribs];
[mDict setObject:aStr forKey:@"email"];
[aStr release];
}
it returns (null) when i run it but i know there are addresses there?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.