ABAddressBook localized properties and Notifications?

I‘m making good progress in implementing the ABAddressBook and its related classes. But there are two things that stop me:
– Do you know where to find the localized strings for the ABRecord properties? The only external method call I found didn‘t work – it turned out Apple Dev center had pointed me to the iOS section … :wink:
– There are two notifications that ABAddressBook class can handle – changed and changed externally. Any hints on how one would implement such things? Would I set up a NSNotification receiver?

Thanks a lot!

Address Book Objective-C Constants Reference

Thanks, Eli, but I still cannot find the localized names. When I call ABAddressBook.properties which is supposed to show all the properties‘ names, it does so, but only the English names. There‘s an ABAddressBookCallbackLocalizedLabel (phew!) external function but only for iOS (which can‘t be, the Xojo built-in class on OS X finds them too.)

So either I was not able to find the method for OS X or I made some mistake in declaring the properties call …?

You need to use CFBundleGetDataPointerForName.

[code]Declare Function dlopen Lib “/usr/lib/libdl.dylib” (path As CString, mode As Int32) As Ptr
Declare Function dlerror Lib “/usr/lib/libdl.dylib” () As CString

Const RTLD_LAZY = &h001

Dim handle As Ptr = dlopen("/System/Library/Frameworks/AddressBook.framework/AddressBook", RTLD_LAZY)

If handle = Nil Then
Dim exc As New RuntimeException()
exc.Message = dlerror()
Raise exc
End

Declare Function CFBundleGetBundleWithIdentifier Lib “CoreFoundation” (bundleID As CFStringRef) As Ptr
Declare Function CFBundleGetDataPointerForName Lib “CoreFoundation” (CFBundleRef As Ptr, symbolName As CFStringRef) As Ptr
Declare Function UTF8String Lib “Foundation” Selector “UTF8String” (NSString As Ptr) As CString

Dim bundle As Ptr = CFBundleGetBundleWithIdentifier(“com.apple.AddressBook.framework”)
Dim kABHomePageLabel As String = UTF8String(CFBundleGetDataPointerForName(bundle, “kABHomePageLabel”).Ptr)
Dim kABEmailWorkLabel As String = UTF8String(CFBundleGetDataPointerForName(bundle, “kABEmailWorkLabel”).Ptr)
…[/code]
There is also a CFBundleGetDataPointerForNames which takes an array of symbol names and returns an array of NSStrings.

I wasn‘t aware of this! Thanks, Eli!

or simply use ABAdressbookMBS, my plugin class for address book.

:slight_smile:
Yes, I know, Christian. This insipred me to try the implementation: Finding addresses is so much faster one can implement a live Update of a search list – although I improved my method that uses the built-in Xojo Addressbook class a lot there‘s still some delay which is nagging me.
And again this is not to degrade your work. I appreciate it a lot. I‘m just still into learning and, hopefully, building up some knowledge, that‘s why I want to find out the details myself. After all, a Pro license doesn‘t make you a pro by itself … wish it could! :smiley: