Re: Correct way to get a person in Address Book
Re: Correct way to get a person in Address Book
- Subject: Re: Correct way to get a person in Address Book
- From: mmalcolm crawford <email@hidden>
- Date: Tue, 11 Nov 2003 20:45:26 -0800
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.