ios - How i do update an existing contact phone number? -


hello trying update contact's phone using following code

abaddressbookref addressbook = abaddressbookcreate();     cferrorref error = nil;     abmutablemultivalueref phonemultivalue = abmultivaluecreatemutable(kabpersonphoneproperty);     bool didaddphone = abmultivalueaddvalueandlabel(phonemultivalue, (cftyperef)(_homephonetext.text), kabhomelabel, null);  if(didaddphone){         abrecordsetvalue(abaddressbookgetpersonwithrecordid(addressbook, [_id integervalue]),                          kabpersonphoneproperty,                          phonemultivalue,                          nil);     } else {         nslog(@"error adding email: %@", error);         error = nil;     } 

but not working. ?

first off: abaddressbookcreate deprecated , not work under ios 6 (it returns null). instead use abaddressbookcreatewithoptions (documentation: http://developer.apple.com/library/ios/#documentation/addressbook/reference/abaddressbookref_iphoneos/reference/reference.html ).

after that, need save address book make changes stick around, calling abaddressbooksave address book.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -