• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Newbe Question: Searching Address Book
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbe Question: Searching Address Book


  • Subject: Re: Newbe Question: Searching Address Book
  • From: Nelson Santos <email@hidden>
  • Date: Tue, 2 May 2006 18:40:08 -0700

Hi Brad,

In the link that Andrew provided, you can find the following sample snippet:



ABAddressBook *AB = [ABAddressBook sharedAddressBook];

ABSearchElement *nameIsSmith =
    [ABPerson searchElementForProperty:kABLastNameProperty
                                 label:nil
                                   key:nil
                                 value:@"Smith"
                            comparison:kABEqualCaseInsensitive];

NSArray *peopleFound = [AB recordsMatchingSearchElement:nameIsSmith];



I haven't tried this myself, but it seems pretty straight forward. The first line just fetches a pointer to the address book. The second statement sets up a search criteria object (by last name, value of Smith, case insensitive). The last statement actually executes the search using the criteria returning an array of all the address book entries found.

See if you can work with this and let us know if you are still having trouble.

Nelson





On May 2, 2006, at 10:25 AM, Brad Bumgarner wrote:

Andrew,

Thank you for your reply. I have read that documentation (many, many times). Unfortunately I haven't been able to figure out how to make it work. I THINK I need to be working with the kABPersonsFlag and the kABShowAsPerson constants. But, since I'm still learning how this all works, I haven't figured this out yet.

Thanks again,
Brad Bumgarner, CTA


On May 2, 2006, at 11:11 AM, Andrew Knott wrote:

Check out

http://developer.apple.com/documentation/UserExperience/Conceptual/ AddressBook/index.html

Andrew

On 2 May 2006, at 18:04, Brad Bumgarner wrote:

It can be very difficult to learn a language on your own. I was/ am hoping that someone here can help me learn how to write obj-c code. I have read the Address Book documentation the comes with Xcode and I just can't figure how to put all the pieces to together. I know what I want to do can be done, Mail.app does it all the time. If I wasn't clear in the wording of my question, please let me know.

Thanks,
Brad Bumgarner, CTA


On May 1, 2006, at 12:02 PM, Brad Bumgarner wrote:

My name is Brad Bumgarner and I am new to Objective-C. I have been using AppleScript since it was first introduced many (many) "moons" ago. I have been using Project Builder / Xcode since OS X 10.2. I have recently decided to step up to using Objective-C so that I may add features to my apps that I can't do (the way I'd like to) in AppleScript Studio. The scary thing is Objective- C is actually starting to make sense :-)

My question: How can I search for a name in Address Book? I want to be able to search for first names, last names and both first/ last names. I want to be able to do this much like Mail.app does. The code below (attached to a text field via AppleScript's "on changed" handler) works until a space character is entered. "theName" is passed from the applescript code and contains the currently entered text from the text field as it is being entered.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40andrewknott.com


This email sent to email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40comcast.net


This email sent to email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Newbe Question: Searching Address Book
      • From: Brad Bumgarner <email@hidden>
References: 
 >Re: Newbe Question: Searching Address Book (From: Brad Bumgarner <email@hidden>)
 >Re: Newbe Question: Searching Address Book (From: Andrew Knott <email@hidden>)
 >Re: Newbe Question: Searching Address Book (From: Brad Bumgarner <email@hidden>)

  • Prev by Date: Re: NSWindowController Subclassing - windowDidLoad Method
  • Next by Date: Re: Refactoring tools available for Cocoa / ObjC?
  • Previous by thread: Re: Newbe Question: Searching Address Book
  • Next by thread: Re: Newbe Question: Searching Address Book
  • Index(es):
    • Date
    • Thread