0

Until iOS 7 I was able to display a ABPersonViewController with the related contact info and by tapping on the phone cell I was able to make a phone call. In iOS 8.3 that I am testing now, this does not work. However tapping on the email cell opens the mail app, tapping on the website cell opens safari and tapping on the address cell opens maps as expected. This is the code I am using to create an instance of ABPersonViewController:

personViewController = new ABPersonViewController ();
personViewController.AllowsEditing = true;
personViewController.AllowsActions = true;
personViewController.Delegate = new PersonViewControllerDelegate ();
personViewController.DisplayedPerson = person;

What should I do to enable phone calling from within the ABPersonViewController in iOS 8 and 9?

Yiannis Mpourkelis
  • 1,366
  • 1
  • 15
  • 34

1 Answers1

0

From iOS 9 we need to use the code below. since the old ones are deprecated!

  CNMutableContact*conDetails=[[CNMutableContact alloc]init];

    if ([conDetails.phoneNumber length]!=0) {

        conDetails.phoneNumbers=[[NSArray alloc]initWithObjects:[CNLabeledValue labeledValueWithLabel:CNLabelPhoneNumberMain value:[CNPhoneNumber phoneNumberWithStringValue:@"your phonenumber"]], nil];
    }
}
JBM
  • 1
  • 1
  • I know that in iOS 9 the previous address book api is marked as deprecated, but for backwards compatibility I still want to use ABPersonViewController API until it is taken out of the newer iOS version. – Yiannis Mpourkelis Nov 02 '15 at 20:38