Re: [iPhone] Addressbook "group" problem

2009-07-13 Thread James Lin
Thank you Roland, and Luke! I got it...thank you for your pointers! ABRecordRef group = CFArrayGetValueAtIndex(grpval, i); NSString *groupName = (NSString *)ABRecordCopyCompositeName(group); This works, finally... Thank you again! James On 2009/7/13, at 下午 3:18, Roland King wrote: Well they

Re: [iPhone] Addressbook "group" problem

2009-07-13 Thread Roland King
no problem. Don't forget about the ownership of that groupName string, the ABRecordCopyCompositeName() returns, it's a copy, you have to CFRelease it or release the NSString. Personally I'd have used the ABRecordCopyValue() method myself with the kABGroupNameProperty because it's more explicit

Re: [iPhone] Addressbook "group" problem

2009-07-13 Thread James Lin
Hi Roland, Luke... Thank you for your pointers... the following finally works... ABRecordRef group = CFArrayGetValueAtIndex(grpval, i); NSString *groupName = (NSString *)ABRecordCopyCompositeName(group); Thank you for your pointers and help...sincerely appreciated! James _

Re: [iPhone] Addressbook "group" problem

2009-07-13 Thread Roland King
Well they aren't strings, they are some kind of opaque type which represents a group. So you can't find it using CFArrayContainsValue with a String. The name is a property of the Group object which is returned. You'll have to iterate the array, get the property for each group which is the name

Re: [iPhone] Addressbook "group" problem

2009-07-12 Thread James Lin
Thank you Roland. Actually, I tried that function...but there is a problem that I can't figure out. the following is my code segment... ABAddressBookRef addressBook=ABAddressBookCreate(); CFArrayRef grpval= ABAddressBookCopyArrayOfAllGroups(addressBook); CFIndex groupCount = ABAd

Re: [iPhone] Addressbook "group" problem

2009-07-12 Thread Luke Hiesterman
Ditto that. Luke Sent from my iPhone. On Jul 12, 2009, at 10:15 PM, Roland King wrote: ABAddressBookCopyArrayOfAllGroups()? James Lin wrote: Hi, Sorry I didn't frame my question more clearly... The part I am having trouble with is finding out if a "group name" already exists in the add

Re: [iPhone] Addressbook "group" problem

2009-07-12 Thread Roland King
ABAddressBookCopyArrayOfAllGroups()? James Lin wrote: Hi, Sorry I didn't frame my question more clearly... The part I am having trouble with is finding out if a "group name" already exists in the addressbook, is there a way to do this? the ABGroup documentation has no function that allo

Re: [iPhone] Addressbook "group" problem

2009-07-12 Thread James Lin
Hi, Sorry I didn't frame my question more clearly... The part I am having trouble with is finding out if a "group name" already exists in the addressbook, is there a way to do this? the ABGroup documentation has no function that allows this... any suggestions? Thank you in advance...

Re: [iPhone] Addressbook "group" problem

2009-07-11 Thread Luke Hiesterman
The group doesn't have a name when you create it. Try setting the name after creation rather than getting it. Luke Sent from my iPhone. On Jul 11, 2009, at 12:50 AM, James Lin wrote: Hi all, Anyone familiar with the Addressbook framework? I can't seem to be able to add a "group" into the

[iPhone] Addressbook "group" problem

2009-07-11 Thread James Lin
Hi all, Anyone familiar with the Addressbook framework? I can't seem to be able to add a "group" into the addressbook only ONCE. if i use ABRecordRef group = ABGroupCreate(); to get a handle on group, calling NSString *groupName = (NSString *)ABRecordCopyCompositeName(group); returns a NUL