Read all contacts-(void) readallpeoples{//Get local communication record name handleabaddressbookref Tmpaddressbook = Abaddressbookcreate ();//Get all local contact recordsnsarray* tmppeoples = (nsarray*) abaddressbookcopyarrayofallpeople (tmpaddressbook);For (id tmpperson in tmppeoples) {//Get Contact single attribute: First namensstring* tmpfirstname = (nsstring*) abrecordcopyvalue (Tmpperson, kabpersonfirstnameproperty);[Tmpfirstname release];//Gets the contact single attribute: Last namensstring* tmplastname = (nsstring*) abrecordcopyvalue (Tmpperson, kabpersonlastnameproperty);[Tmplastname release];//Get Contact Single attribute: Nicknamensstring* tmpnickname = (nsstring*) abrecordcopyvalue (Tmpperson, Kabpersonnicknameproperty); [Tmpnickname release];//Get Contact Single attribute: Company namensstring* tmpcompanyname = (nsstring*) abrecordcopyvalue (Tmpperson, kabpersonorganizationproperty);[Tmpcompanyname release];//Get Contact single attribute: Job Titlensstring* tmpjobtitle= (nsstring*) abrecordcopyvalue (Tmpperson, kabpersonjobtitleproperty);[Tmpjobtitle release];//Get Contact single attribute: Department namensstring* tmpdepartmentname = (nsstring*) abrecordcopyvalue (Tmpperson, kabpersondepartmentproperty);[Tmpdepartmentname release];//Get Contact Single attribute: Email (s)abmultivalueref tmpemails = Abrecordcopyvalue (Tmpperson, kabpersonemailproperty);For (Nsinteger j = 0; J < Abmultivaluegetcount (tmpemails); j + +) {nsstring* Tmpemailindex = (nsstring*) Abmultivaluecopyvalueatindex (Tmpemails, j);[Tmpemailindex release]; }cfrelease (tmpemails);//Get Contact single attribute: Birthdaynsdate* tmpbirthday = (nsdate*) abrecordcopyvalue (Tmpperson, kabpersonbirthdayproperty);[Tmpbirthday release];//Get Contact single attribute: notensstring* tmpnote = (nsstring*) abrecordcopyvalue (Tmpperson, kabpersonnoteproperty);[Tmpnote release];//Get Contact single attribute: Generic phone numberabmultivalueref tmpphones = Abrecordcopyvalue (Tmpperson, kabpersonphoneproperty);For (Nsinteger j = 0; J < Abmultivaluegetcount (Tmpphones); j + +) {nsstring* Tmpphoneindex = (nsstring*) Abmultivaluecopyvalueatindex (Tmpphones, j);[Tmpphoneindex release]; }cfrelease (tmpphones); }//Free memory[Tmppeoples release];cfrelease (tmpaddressbook);}
iOS Get contact information