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开发者_Go百科);
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.
This post may be helpful.
Obtaining Specific ABSource from ABAddressBook in iOS 4+
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 : (
According to the ABGroup reference, "Groups may not contain other groups."
精彩评论