Changes between Initial Version and Version 1 of AddressBook


Ignore:
Timestamp:
Mar 29, 2008, 3:17:39 AM (13 years ago)
Author:
rme
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AddressBook

    v1 v1  
     1= Using the Address Book framework =
     2
     3Here's a bare-bones example of how to load and use the Address Book framework.
     4
     5{{{
     6;;; Load the framework
     7? (objc:load-framework "AddressBook" :addressbook)
     8NIL
     9;;; Looks like it worked...
     10? ns:ab-address-book
     11#<AB-ADDRESS-BOOK <ABAddressBook: 0x1743c300> (#x1743C300)>
     12}}}
     13
     14Here's some really simple sample.  Load the file with this code, and you'll
     15be able to say `(absearch "smith")` to look for the Smiths in your Address Book.
     16Note that the output from NSLog will go to the system console.
     17{{{
     18(in-package "CCL")
     19
     20(defun absearch (surname)
     21  (let* ((ab (#/sharedAddressBook ns:ab-address-book))
     22         (search (#/searchElementForProperty:label:key:value:comparison:
     23                  ns:ab-person
     24                  #&kABLastNameProperty
     25                  +null-ptr+
     26                  +null-ptr+
     27                  (#/autorelease (%make-nsstring surname))
     28                  #$kABEqualCaseInsensitive))
     29         (results (#/recordsMatchingSearchElement: ab search)))
     30    (#_NSLog #@"%@" :id results :id +null-ptr+)))
     31}}}
     32
     33