Im 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 didnt work it turned out Apple Dev center had pointed me to the iOS section
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!
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. Theres an ABAddressBookCallbackLocalizedLabel (phew!) external function but only for iOS (which cant 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()
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)
There is also a CFBundleGetDataPointerForNames which takes an array of symbol names and returns an array of NSStrings.
I wasnt aware of this! Thanks, Eli!
or simply use ABAdressbookMBS, my plugin class for address book.
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 theres still some delay which is nagging me.
And again this is not to degrade your work. I appreciate it a lot. Im just still into learning and, hopefully, building up some knowledge, thats why I want to find out the details myself. After all, a Pro license doesnt make you a pro by itself
wish it could!