AddressBook -- more issues
AddressBook -- more issues
- Subject: AddressBook -- more issues
- From: Hasan Diwan <email@hidden>
- Date: Fri, 14 Feb 2003 22:01:24 -0800
I have at least one complete address (at least my own) defined in the
addressbook database, but the following code, which is supposed to
print the addresses. I'd appreciate some help as to what's wrong, as I
have no clue. Thanks for the help.
// Begin file
#import <AddressBook/AddressBook.h>
#import <Cocoa/Cocoa.h>
int main(int argc, char **argv) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSArray *data = [[ABAddressBook sharedAddressBook] people];
[data makeObjectsPerformSelector:@selector(printStreet:)
withObject:nil];
[pool release];
return 0;
}
@interface ABPerson (HDArray)
- (void)printStreet:(id)r;
@end
@implementation ABPerson (HDArray)
- (void)printStreet:(id)r {
id rVal = [r valueForProperty:kABAddressProperty];
NSLog(@"%@\n%@, %@ %@\n%@\n----------\n", [rVal
valueForProperty:kABAddressStreetKey],[rVal
valueForProperty:kABAddressCityKey],[rVal
valueForProperty:kABAddressStateKey] , [rVal
valueForProperty:kABAddressZIPKey] ,[rVal
valueForProperty:kABAddressCountryKey]);
}
@end
Hasan Diwan
OpenPGP KeyID: 0x7EE3855B
Fingerprint: 42F0 5758 C3EB BA1F ABD2 ED49 3390 CCF0 7EE3 855B
http://www.cs.rpi.edu/~diwanh/gpg.key
[demime 0.98b removed an attachment of type application/pgp-signature which had a name of PGP.sig]
_______________________________________________
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.