• 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: AddressBook - how to search for absence of value?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AddressBook - how to search for absence of value?


  • Subject: Re: AddressBook - how to search for absence of value?
  • From: Vince DeMarco <email@hidden>
  • Date: Tue, 15 Oct 2002 16:15:06 -0700

On Tuesday, October 15, 2002, at 01:59 PM, Jim Correia wrote:

[Pardon the question on the Cocoa list. As far as I know there isn't a specific list for the AddressBook.]

I'd like to query the Address Book for the absence of a term. Specifically I want to find all values whose first name is empty, and whose last name starts with a specific value. The following code doesn't work. When I log all the values from the address book it doesn't log any value for the first name of the entry that doesn't have one.

What am I doing wrong?

I just tried this on my and address book is definitely broken. here. I'll file a bug for you. its bug #3076439

vince

Thanks,
Jim

#import <AddressBook/AddressBook.h>
#import <Foundation/Foundation.h>

int main (int argc, const char * argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

ABSearchElement *elem1 = [ABPerson searchElementForProperty: kABFirstNameProperty label: nil key: nil value: @"" comparison: kABEqual];

ABSearchElement *elem2 = [ABPerson searchElementForProperty: kABLastNameProperty label: nil key: nil value: @"z" comparison: kABPrefixMatchCaseInsensitive];

NSArray *elements = [NSArray arrayWithObjects: elem1, elem2, nil];

ABSearchElement *conjunction = [ABSearchElement searchElementForConjunction: kABSearchAnd children: elements];

NSArray *matches = [[ABAddressBook sharedAddressBook] recordsMatchingSearchElement: conjunction];

NSLog(@"%@", matches);
NSLog(@"%@", [[ABAddressBook sharedAddressBook] people]);

[pool release];
return 0;
}
_______________________________________________
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.
_______________________________________________
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.

  • Follow-Ups:
    • Re: AddressBook - how to search for absence of value?
      • From: Jim Correia <email@hidden>
References: 
 >AddressBook - how to search for absence of value? (From: Jim Correia <email@hidden>)

  • Prev by Date: Re: Mixing Objective C and C++
  • Next by Date: Re: AddressBook - how to search for absence of value?
  • Previous by thread: AddressBook - how to search for absence of value?
  • Next by thread: Re: AddressBook - how to search for absence of value?
  • Index(es):
    • Date
    • Thread