• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Accessing AB email values
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: selection -> object
  • Next by Date: Re: Save a NSAppleScript to a file
  • Previous by thread: selection -> object
  • Next by thread: ZeroLink and dynamic discovered Classes
  • Index(es):
    • Date
    • Thread