1

I created a cordova 2.8.0 iOS project on my Xcode 6.0.1

The project is run on an iPhone 6 simulator with iOS 8

The plugin I am using is this https://github.com/hazemhagrass/ContactPicker it works well on Android(the contact overlay opens and when the user selects a contact, the control is returned with the selected contact's name, phone number, email etc)

However in iOS I am having some issues.

The warnings I am getting in ContactPicker.m are shown in the snapshot

ContactPicker Plugin Warning Snapshot

Now the contacts overlay is opening fine.

Contacts Overlay

But When I select a contact, the selected contacts details are not getting returned. I am only seeing the selected contact's detail page and control is not returning to the Phonegap application, like it does on the Android

Contacts Details

The code for ContactPicker.m https://github.com/hazemhagrass/ContactPicker/blob/master/src/ios/ContactPicker.m

The code for ContactPicker.h https://github.com/hazemhagrass/ContactPicker/blob/master/src/ios/ContactPicker.h

Thanks for your help

Few more insights, I am not an Objective C person, however by debugging I found that “chooseContact" method from ContactPicker.m is getting called as the overlay pops up, after that as the user selects contacts no other method from ContactPicker.m is getting called. But once I hit the Cancel button “peoplePickerNavigationControllerDidCancel" method is getting called and it returns back to Phonegap App without any contactInfo.

joel
  • 747
  • 2
  • 9
  • 20

1 Answers1

1

Issue solved

Just include the following code in ContactPicker.m

- (void)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker didSelectPerson:(ABRecordRef)person{
    [self peoplePickerNavigationController:peoplePicker shouldContinueAfterSelectingPerson:person];
}

Sources:

  1. ABPeoplePickerNavigationController changes with iOS8?

  2. People Picker with ios 7, and ios 8

Community
  • 1
  • 1
joel
  • 747
  • 2
  • 9
  • 20