1. Import Contactsui.framework contacts.framework
2. Import in VIEWCONTROLLER.M
#import <Contacts/Contacts.h>
#import <ContactsUI/ContactsUI.h>
3. Run the following code in VIEWCONTROLLER.M
Get Contacts
Self.phonearr = [[Nsmutablearray alloc] init];
Cncontactstore *store = [[Cncontactstore alloc] init];
Cncontactfetchrequest *request = [[Cncontactfetchrequest alloc] initwithkeystofetch:@[ Cncontactphoneticfamilynamekey, Cncontactphonenumberskey]];
[Store Enumeratecontactswithfetchrequest:request Error:nil usingblock:^ (cncontact * _nonnull Contact, BOOL * _Nonnull Stop) {
NSLog (@ "..... %@ ", contact.phonenumbers);
Nsarray *phonenums = contact.phonenumbers;
For (Cnlabeledvalue *labledvalue in phonenums) {
Cnphonenumber *phonenumber = Labledvalue.value;
NSString *phonevalue = Phonenumber.stringvalue;
[Self.phonearr Addobject:phonevalue];
}
}];
IOS Get Contacts