views:

27

answers:

0

hello guys, In my app,I try to save the contacts to the address book: here is the code:

ABRecordRef aRecord=ABPersonCreate();
ABRecordSetValue(aRecord,kABPersonNicknameProperty,(NSString*)nickName,&anError);
ABAddressBookRef addressBook=ABAddressBookCreate();
if(!ABAddressBookAddRecord(addressBook, aRecord, &anError))
{
   //pop up an alertView  
}
if(!ABAddressBookSave(addressBook,&anError))
{
  //pop up an alertView
}

on most of the device,the result can be successfully saved to the address book. however,on one device,there happens to be a problem: when I use the search function for Contacts, the saving item does not show up. But when I use the global search function for the phone, it DOES show up. by the way,the alertView did not show up when when save the contacts.and the device has no jailbreak.

So what is the problem? Is that because the device has some specific setting preventing it from writing items to the contacts or the app's bug?

Thanks for your help.