Tutorial by Examples

Importing the framework Swift import Contacts Objective-C #import <Contacts/Contacts.h> Checking accessibility Swift switch CNContactStore.authorizationStatusForEntityType(CNEntityType.Contacts){ case .Authorized: //access contacts case .Denied, .NotDetermined: //request permissio...
Applying a filter To access contacts, we should apply a filter of type NSPredicate to our contactStore variable which we defined it in Authorizing Contact Access example. For example, here we want to sort out contacts with name matching with our own: Swift let predicate = CNContact.predicateForCo...
Swift import Contacts // Creating a mutable object to add to the contact let contact = CNMutableContact() contact.imageData = NSData() // The profile picture as a NSData object contact.givenName = "John" contact.familyName = "Appleseed" let homeEmail = CNLabele...

Page 1 of 1