ios - Select contact email with ABPeoplePickerNavigationController tries to send email instead -


i've got objective c project using abpeoplepickernavigationcontroller select contact's email address.

code so:

-(ibaction)_email_contactsbuttonpushed_orig:(uibutton*)contactsbutton { [analyticswrapper logevent:@"share_via_contacts_clicked"];  // abpeoplepickernavigationcontroller _contactpicker = [[abpeoplepickernavigationcontroller alloc] init]; _contactpicker.peoplepickerdelegate = self; _contactpicker.delegate = self;   // define properties show when viewing specific person _contactpicker.displayedproperties = [nsarray arraywithobjects:@(kabpersonemailproperty), nil];  // style nav bar [[qpdrawing shared] paintnavbarincontroller:_contactpicker];    // showing picker if (isipad) {      self.peoplepopovercontroller = [[uipopovercontroller alloc] initwithcontentviewcontroller:_contactpicker];     _peoplepopovercontroller.delegate = self;      cgrect b = self.homeviewcontroller.view.bounds;     cgrect b2 = (cgrect){         b.size.width/2-5,0,         10,self.homeviewcontroller.headerview.bounds.size.height     };     b2 = _emailcontactsbutton.frame;     b2.origin.y += self.view.frame.origin.y; // push box down account header     [_peoplepopovercontroller presentpopoverfromrect:b2                                               inview:self.homeviewcontroller.view                             permittedarrowdirections: uipopoverarrowdirectionany                                             animated:yes]; } else {      [self.homeviewcontroller presentviewcontroller:_contactpicker animated:yes completion:nil]; }  } 

the popup appears okay, , can select contact. when select contact, opens contact detail. however, when click on email address, switches email app , composing email -- if had opened contacts app etc..

the callbacks peoplepickernavigationcontroller:didselectperson never gets called.

this isn't code originally, i'm told used work. other developers have worked not project though, don't know if changes made broke or not. know peoplepickernavigationcontroller little dated.

any appreciated. thanks!

edit -- additional info regarding delegate methods:

shouldcontinueafterselectingperson:

// called after person has been selected user. // return yes if want person displayed. // return no  nothing (the delegate responsible dismissing peoplepicker). - (bool)peoplepickernavigationcontroller:(abpeoplepickernavigationcontroller *)peoplepicker shouldcontinueafterselectingperson:(abrecordref)person {   _addressbookfirstname = (__bridge nsstring *)abrecordcopyvalue(person, kabpersonfirstnameproperty); _addressbooklastname = (__bridge nsstring *)abrecordcopyvalue(person, kabpersonlastnameproperty);  // continue on person's details return yes; } 

shouldcontinueafterselectingperson:property:identifier:

- (bool)peoplepickernavigationcontroller:(abpeoplepickernavigationcontroller *)peoplepicker shouldcontinueafterselectingperson:(abrecordref)person property:(abpropertyid)property identifier:(abmultivalueidentifier)identifier {  if ( property != kabpersonemailproperty ) {     return no; } 

if wish allow user select contact's email , want email delegate method need implement peoplepickernavigationcontroller:didselectperson:property:identifier:.

- (void)peoplepickernavigationcontroller:(abpeoplepickernavigationcontroller *)peoplepicker didselectperson:(abrecordref)person property:(abpropertyid)property identifier:(abmultivalueidentifier)identifier {     if (property == kabpersonemailproperty) {         // email property has been selected on person         abmultivalueref ref = abrecordcopyvalue(person, property);         cfindex idx = abmultivaluegetindexforidentifier(ref, identifier);         nsstring *email = (__bridge_transfer nsstring *)abmultivaluecopyvalueatindex(ref, idx);         cfrelease(ref);          _addressbookfirstname = (__bridge_transfer nsstring *)abrecordcopyvalue(person, kabpersonfirstnameproperty);         _addressbooklastname = (__bridge_transfer nsstring *)abrecordcopyvalue(person, kabpersonlastnameproperty);     } } 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -