• 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: "Mike R. Manzano" <email@hidden>
  • Date: Tue, 11 Nov 2003 20:16:45 -0800

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

You have to cast the returned record into a person since a record isn't derived from a person. Automatic casting only would work if the return of the method was a person and you were assigning it to a record -- there is no way for the compiler to know that the returned record is actually a person.

Mike



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

I am new to Objective-C and Cocoa and I have a question. I have the
following code (where abID is an NSString containing the UID):

_macAddressBook = [ABAddressBook sharedAddressBook];
[_macAddressBook retain];
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?

Thank you,

Darwin
_______________________________________________
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.

References: 
 >Correct way to get a person in Address Book (From: Darwin Zins <email@hidden>)

  • Prev by Date: Re: No man pages when installing xcode?
  • Next by Date: Re: XCode not releasing nsstring
  • Previous by thread: 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