Use a third-party framework Rhaddressbook to obtain a communication record

Source: Internet
Author: User

Official address: Https://github.com/heardrwt/RHAddressBook

1. Installation configuration: http://rheard.com/blog/using-static-ios-libraries/

Main steps

Http://rheard.com/skitch/UsingStaticLibraries1-20121104-223027.png

Http://rheard.com/skitch/UsingStaticLibraries2-20121104-223532.png

Http://rheard.com/skitch/UsingStaticLibraries4-20121104-224413.png

On the code:

////VIEWCONTROLLER.M#import "ViewController.h"#import<RHAddressBook/AddressBook.h>@interfaceViewcontroller ()@end@implementationViewcontroller- (void) viewdidload {[Super viewdidload];}- (void) Touchesbegan: (Nsset *) touches withevent: (Uievent *)Event{    //1. Get Authorization statusRhauthorizationstatus status =[Rhaddressbook Authorizationstatus]; //2. Determine if it is not authorized, return directly    if(Status! = rhauthorizationstatusauthorized)return; //3. Create a Correspondence recordRhaddressbook *addressbook =[[Rhaddressbook alloc] init]; //4. Get all the contactsNsarray *peoplearray =addressbook.people; //5. Traverse all the Contacts     for(Rhperson *personinchPeoplearray) {                //6. Get the name of the contact personNSLog (@"%@ %@", Person.firstname, person.lastname); //7. Get the phone numberRhmultivalue *phones =person.phonenumbers;  for(inti =0; i < Phones.count; i++) {            //8. Get the phone number and the corresponding labelNSString *phonelabel =[Phones labelatindex:i]; NSString*phonevalue =[Phones valueatindex:i]; NSLog (@"%@ %@", Phonelabel, Phonevalue); }    }}@end

Use a third-party framework Rhaddressbook to obtain a communication record

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.