• 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: Correct way to get a person in Address Book
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Correct way to get a person in Address Book


  • Subject: Re: Correct way to get a person in Address Book
  • From: Darwin Zins <email@hidden>
  • Date: Tue, 11 Nov 2003 23:31:59 -0600

That is what I was looking for thanks, not really an Objective-C issue, heh.

The code that I am working on can be obtained here:

http://maczsync.sourceforge.net/

The way it updates the Mac Address Book is by deleting the current entry and then re-adding it. I am changing that so that it just updates the entry so it doesn't lose information in the Mac Address Book that it's not syncing.

Thanks for the help,

Darwin

On Nov 11, 2003, at 10:45 PM, mmalcolm crawford wrote:

On Nov 11, 2003, at 6:42 PM, Darwin Zins wrote:

ABPerson * macABEntry;
macABEntry = [_macAddressBook recordForUniqueId: abID ];
Compiling this gives me a warning "assignment from incompatible pointer
type" for the last line. The code actually works, but what is the
correct way to do this?

recordForUniqueId: is defined to return ABRecord -- it may be an ABPerson or an ABGroup. If you are *sure* the record returned will *always* be an ABPerson, then you could suppress the compiler warning with:

ABPerson * macABEntry;
macABEntry = (ABPerson *)[_macAddressBook recordForUniqueId: abID ];


[_macAddressBook retain];

It might be interesting to see the remainder of your code -- it's more likely than not that you don't need to retain the address book, or that there's a better approach...


Finally, searching with unique IDs is perhaps not the most obvious first step in using the AddressBook framework -- have you looked at creating ABSearchElements?

From <http://developer.apple.com/documentation/UserExperience/Reference/ AddressBook/ObjC_classic/Classes/ABAddressBook.html>

- (NSArray *)recordsMatchingSearchElement:(ABSearchElement *)search
Returns an array of records that match the given search element, or returns an empty array if no records match the search element. [...]
See Also: + searchElementForProperty:label:key:value:comparison: (ABPerson) [...]


mmalc
_______________________________________________
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: Correct way to get a person in Address Book
      • From: mmalcolm crawford <email@hidden>
References: 
 >Correct way to get a person in Address Book (From: Darwin Zins <email@hidden>)
 >Re: Correct way to get a person in Address Book (From: mmalcolm crawford <email@hidden>)

  • Prev by Date: Programatically initializing documents.
  • Next by Date: Re: Xcode / Interface Builder Bug?
  • Previous by thread: Re: Correct way to get a person in Address Book
  • Next by thread: Re: Correct way to get a person in Address Book
  • Index(es):
    • Date
    • Thread