- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.groupOfContacts = [@[] mutableCopy];
[self getAllContact];
self.phoneNumberArr = [@[] mutableCopy];
for (CNContact *contact in self.groupOfContacts) {
NSArray *thisOne = [[contact.phoneNumbers valueForKey:@"value"] valueForKey:@"digits"];
// like this way you can pick different info like b'day and anniversary
[self.phoneNumberArr addObjectsFromArray:thisOne];
}
NSLog(@"%@",self.phoneNumberArr);
NSLog(@"%@",self.groupOfContacts[0]);
// Override point for customization after application launch.
return YES;
}
-(void)getAllContact{
if ([CNContactStore class]) {
CNContactStore *addressBook = [[CNContactStore alloc]init];
NSArray *keysToFetch = @[CNContactBirthdayKey,CNContactNamePrefixKey,CNContactPhoneNumbersKey,CNContactFamilyNameKey,CNContactRelationsKey,CNContactDatesKey];
CNContactFetchRequest *fetchRequest = [[CNContactFetchRequest alloc]initWithKeysToFetch:keysToFetch];
[addressBook enumerateContactsWithFetchRequest:fetchRequest error:nil usingBlock:^(CNContact * _Nonnull contact, BOOL * _Nonnull stop) {
[self.groupOfContacts addObject:contact];
}];
}
}
Sie so etwas wie diese Änderung Tasten wie pro Anforderungen tun. hoffe das hilft :)
ThanQ @Vizllx, Was Anniversary Label? –