Attempting to match phone numbers in the Address Book
Attempting to match phone numbers in the Address Book
- Subject: Attempting to match phone numbers in the Address Book
- From: Rowan <email@hidden>
- Date: Mon, 19 Apr 2004 21:22:07 +0100
I wasn't sure which list to post this to, so as always the fallback is
cocoa-dev :)
I've added a simple Caller ID function to an app which uses the address
book framework to check for known numbers; however, while this works,
it has a couple of problems. I'm using an ABSearchElement equal to
[ABPerson searchElementForProperty:kABPhoneProperty label:nil key:nil
value:aString comparison:kABEqual], and while this seems to work for
numbers entered via a phone, it doesn't match numbers entered in the
Address Book.
I've tracked this down to the "Automatically format phone numbers"
option in Address Book. Numbers entered via a phone and then
transferred via iSync seem to be stored as 123456789, and displayed as
(123) 456 789, whereas numbers entered directly into Address Book seem
to be stored as (123) 456 789. In the former case, passing 123456789
to the ABSearchElement finds a match; in the latter case, no match is
found.
So passing a normal string to the value: option doesn't match unless
you pass the formatted number, if what I'm seeing is correct. What's
the recommended method for matching Address Book formatting? Should I
grab ABPhoneFormat-PhoneFormatter from com.apple.AddressBook.plist and
pre-format my numbers before trying to match them?
Interestingly enough, if the number formatting preference is changed,
the Address Book displayed value changes; however, searching by the new
string matches nothing, while searching by the old string provides a
match. Is anything possible in these situations?
Cheers,
--Rowan
_______________________________________________
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.