创建联系人组

时间:2013-11-28 12:48:43

标签: ios contacts abaddressbook

ABAddressBookRef ab = ABAddressBookCreate();
CFErrorRef error;
ABRecordRef group = ABGroupCreate();
ABRecordSetValue(group, kABGroupNameProperty,@"new group", &error);
ABAddressBookAddRecord(ab, group, &error);
ABAddressBookSave(ab, &error);

CFRelease(group);

我尝试使用此代码创建联系人组。我多么不成功。需要帮助。

更新:

CFErrorRef error;
ABAddressBookRef ab = ABAddressBookCreateWithOptions(NULL,&error);
ABRecordRef group = ABGroupCreate();
ABRecordSetValue(group, kABGroupNameProperty,@"new group", &error);
ABAddressBookAddRecord(ab, group, &error);
ABAddressBookSave(ab, &error);
NSLog(@"%@",error);
CFRelease(group);

现在只打印(null).....

0 个答案:

没有答案