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).....