0

I know in swift how to pick Birthday Label from CNContactPickerViewController, but i am little bit confuse in Objective-c

Here i use code like:In Objective-c

How can i pick Birthday label in "didSelectContactProperty" method. Can you please help me out..

-(void)presentContacts {
    CNContactPickerViewController *picker = [[CNContactPickerViewController alloc] init];
    NSArray *propertyKeys = @[CNContactBirthdayKey, CNContactPhoneNumbersKey, CNContactGivenNameKey, CNContactFamilyNameKey, CNContactOrganizationNameKey];
    NSPredicate *enablePredicate = [NSPredicate predicateWithFormat:@"birthday != nil"];

    picker.displayedPropertyKeys = propertyKeys;
    picker.predicateForEnablingContact = enablePredicate;
    picker.delegate = self;

    [self presentViewController:picker animated:YES completion:nil];
}

- (void)contactPickerDidCancel: (CNContactPickerViewController *) picker {
    NSLog(@"didCancel");
}

- (void)contactPicker: (CNContactPickerViewController *) picker didSelectContact: (CNContact *)contact{    
    NSLog(@"didSelectContact");
}

- (void)contactPicker: (CNContactPickerViewController *) picker didSelectContactProperty: (CNContactProperty *)contactProperty{
     NSLog(@"didSelectProperty");
}
Michaël Azevedo
  • 3,874
  • 7
  • 31
  • 45
Mannam Brahmam
  • 2,225
  • 2
  • 24
  • 36
  • check this http://stackoverflow.com/questions/17975297/retrieve-all-contacts-phone-numbers-in-ios – kb920 Apr 25 '16 at 06:08
  • currently i am using XCode 7.3, i need to get solution for this question using Contact Framework and ContactUI Framework these frameworks – Mannam Brahmam Apr 25 '16 at 06:11
  • And more over i want to pick specific contact from "CNContactPickerViewController" only. I don't want to show all contacts birthdays list at a time... – Mannam Brahmam Apr 25 '16 at 06:15
  • http://stackoverflow.com/questions/32669612/how-to-fetch-all-contacts-record-in-ios-9-using-contacts-framework check @Eridana answer – kb920 Apr 25 '16 at 06:16
  • Hi @@Eridana, I clearly mentioned "How to Pick Birthday Label from CNContactPickerViewController in objective-c?" .. I already know how to get all contacts list(fname, lname, profilepic, emailid and etc..) – Mannam Brahmam Apr 25 '16 at 06:22
  • - (void)contactPicker: (CNContactPickerViewController *) picker didSelectContact: (CNContact *)contact{ NSLog(@"didSelectContact"); } -----> here i need to write some code to get Birth day label. How can i get? – Mannam Brahmam Apr 25 '16 at 06:25
  • `CNContact` has a `birthday` property. – pronebird Apr 25 '16 at 08:32

0 Answers0