I'm developing an iPhone app for a small business owner.
All of the biz owner's clients are in the iPhone's Contacts (AddressBook)
The model will include a "Client" class which will be selected from the biz owner's list of contacts in the AddressBook. Seems like the Client class should have just a reference (pointer) to the uniqueID from the AddressBook.
From this post it seems like subclassing ABRecord is not an option.
I'm thinking that [client lastName] should return the string from the address book.
Here's my implementation of Client class' getters:
Client.m
- (NSString *)firstName
{
ABAddressBookRef addressBook = ABAddressBookCreate();
ABRecordRef person = ABAddressBookGetPersonWithRecordID(addressBook, [self employeeId]);
return (NSString *)ABRecordCopyValue(person, kABPersonFirstNameProperty);
}
- (NSString *)lastName
{
ABAddressBookRef addressBook = ABAddressBookCreate();
ABRecordRef foo = ABAddressBookGetPersonWithRecordID(addressBook, [self employeeId]);
return (NSString *)ABRecordCopyValue(foo, kABPersonLastNameProperty);
}
Is there a better way to do this?
Another way to pose the question: In iOS, is there a nice technique for creating a thin wrapper around AddressBook records?
I played around with Groups in AddressBook but felt like the framework's support was not quite there.