3
アドレス帳にコードでいくつかのグループを作成しました。特定のグループを削除するには、以下のコードを使用します。 ABAddressBookRemoveRecord()は、YESを返します。グループはまだそこにいる! コードに問題がありますか?アドレス帳からグループを削除する
BOOL res;
CFErrorRef error;
ABAddressBookRef ab = ABAddressBookCreate();
NSArray *groups = (NSArray *) ABAddressBookCopyArrayOfAllGroups(ab);
for (id _group in groups)
{
NSString *currentGroupName = [[NSString alloc] init];
currentGroupName = (NSString*) ABRecordCopyValue(_group, kABGroupNameProperty);
if ([groupName isEqualToString:currentGroupName])
{
[currentGroupName release];
res = ABAddressBookRemoveRecord(ab, _group, &error);
return res;
}
[currentGroupName release];
}
return NO;
ありがとう、私はそれを保存する必要があるか分からなかった。 :) – Hadu
ありがとう情報 – iOSAppDev