Get iPhone's contacts list in Objective-C -
i'd iphone's contacts list without using ios navigation picker
. here's code wrote...but it's not working, know why?
abaddressbookref addressbook = abaddressbookcreatewithoptions(null, null); cfarrayref allpeopleref = abaddressbookcopyarrayofallpeopleinsourcewithsortordering(addressbook, nil, kabpersonsortbyfirstname); cfindex npeople = abaddressbookgetpersoncount(addressbook); for(int i=0; i<npeople; i++){ abrecordref ref = cfarraygetvalueatindex(allpeopleref, ); cfstringref tmpstringref = abrecordcopyvalue(ref, kabpersonfirstnameproperty); nslog(@"firstname: %@", (__bridge nsstring *)tmpstringref); cfrelease(tmpstringref); } cfrelease(allpeopleref); cfrelease(addressbook);
Comments
Post a Comment