Re: [iPhone] Addressbook "group" problem
Re: [iPhone] Addressbook "group" problem
- Subject: Re: [iPhone] Addressbook "group" problem
- From: James Lin <email@hidden>
- Date: Mon, 13 Jul 2009 14:53:08 +0800
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 = ABAddressBookGetGroupCount(addressBook);
CFRange range = CFRangeMake(0, 1);
NSArray *convertedArray = (NSArray *)grpval;
if (CFArrayContainsValue(grpval, range, @"Dangle Three"))
{
NSLog(@"Yes, it contains the group");
}
NSLog(@"tthe group count is %d", groupCount);
NSLog(@"the group name is %@", (NSString
*)CFArrayGetValueAtIndex(grpval, 0));
NSLog(@"The converted group is nsarray %@", [convertedArray
objectAtIndex:0]);
the output i get from the NSLog statements are:
2009-07-13 14:29:08.686 KSOne[7520:20b] tthe group count is 1
2009-07-13 14:29:08.687 KSOne[7520:20b] the group name is <NSCFType:
0x119e1a0>
2009-07-13 14:29:08.688 KSOne[7520:20b] The converted group is nsarray
<NSCFType: 0x119e1a0>
For some reason, the toll-free bridging doesn't work.
although i can get the count of the group array of 1 correctly,
the actual group name remains illusive to me :(
any ideas?
what's "NSCFType"?
what am I doing wrong?
Thank you in advance...
James
On 2009/7/13, at 下午 1:15, 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 addressbook,
is there a way to do this? the ABGroup documentation has no
function that allows this...
any suggestions?
Thank you in advance...
James
On 2009/7/11, at 下午 9:36, Luke Hiesterman wrote:
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 <email@hidden>
wrote:
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 NULL.
so I can't seem to be able to check if a group name already
exists and don't have to re-create the group again.
Can you please help me and point me in the right direction?
How do I create group only "once"?
Thank you and best regards...
James
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the
list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden