0

I am new to this contacts applications in iPhone applications. my requirement is to add groups and sub groups to the groups Programmatically. I have achieved how to add groups to the iPhone default contact database. now I want add sub-groups to the existing groups.

I have tried to add sub-group to the groups by using ABgroup method ABGroupCreateInSource() my code is like this

ABRecordRef subGroup = ABGroupCreateInSource(group);
ABRecordSetValue(subGroup, kABGroupNameProperty, groupName, &error);
ABAddressBookAddRecord(contacts, subGroup, &error);
ABAddressBookSave(contacts, &error); 

but application is crashing by giving exception like "Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType length]: unrecognized selector sent to instance 0x158190'"

some body please help me. some help will be really helpful to my application.

Thanks in Advance.

John Canady
  • 79
  • 1
  • 11

3 Answers3

0

This post may be helpful.

Obtaining Specific ABSource from ABAddressBook in iOS 4+

Community
  • 1
  • 1
xyzzycoder
  • 1,831
  • 13
  • 19
0
ABRecordRef subGroup = ABGroupCreateInSource(group);

is definately wrong.Since the souce is not indicate the super group.The soure should be ABSource type,not the ABGroup.

As I know there are no concept of subgroup.Sorry about that : (

0

According to the ABGroup reference, "Groups may not contain other groups."

lkiss80
  • 756
  • 9
  • 8