Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ANN: Address Book helper library



Hi,

In our continuing effort to help the Mac OS X development community,
JTech Softworks, Inc. is proud to announce the release the source to a
small Address Book helper. This code is a set of interface extensions
to the ABMultiValue, ABRecord and ABPerson classes provided by the base
framework that make property access and writing easier and more "Cocoa"
like. Since they are interface extensions and not derivations, you only
work with an ABMultiValue, ABRecord or ABPerson object and call the
extended methods provided by this code.

A simple example of using these extensions:

ABAddressBook* book = [ABAddressBook sharedAddressBook];
ABPerson* person = [book me];

NSLog( [person fullName] );
NSLog( [person primaryEmail] );
NSLog( [NSString stringWithFormat:@"Work Email: %@", [person
workEmail]] );
NSLog( [NSString stringWithFormat:@"Home Email: %@", [person
homeEmail]] );
NSLog( [person primaryPhone] );
NSLog( [NSString stringWithFormat:@"Work Phone: %@", [person
workPhone]] );
NSLog( [NSString stringWithFormat:@"Home Phone: %@", [person
homePhone]] );

NSDictionary* primAddr = [person primaryAddress];

if ( primAddr )
{
NSLog ( [person streetFromAddress:primAddr] );
NSLog ( [person cityFromAddress:primAddr] );
NSLog ( [person stateFromAddress:primAddr] );
NSLog ( [person zipFromAddress:primAddr] );
NSLog ( [person countryFromAddress:primAddr] );
}

The code, plus a short example driver that includes the code above, can
be retrieved from the following URL:

http://www.jtechsoftworks.com/samples/JTAddressBook.sit

The download contains a full Cocoa Tool app that is both an example of
using the code as well a a quick test tool.

I hope people find this code useful. If so, a short note of recognition
in your application would be cool. :-)

If you extend the code or fix any bugs in it, please make sure you send
the changes to me so I can keep my source base up.

Thank you,
Joseph Jones
_______________________________________________
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.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.