ios - How can I get string values out of an ABPersonRef / ABPerson? -



ios - How can I get string values out of an ABPersonRef / ABPerson? -

this question arose while using [pkpayment billingaddress], listed type abrecordref (but more precise, of type abpersonref).

nsstring *streetaddress; if (abmultivaluegetcount(addressmultivalueref) > 0) { cfdictionaryref dict = abmultivaluecopyvalueatindex(addressmultivalueref, 0); streetaddress = (__bridge nsstring *)cfdictionarygetvalue(dict, kabpersonaddressstreetkey); } nsstring *city; if (abmultivaluegetcount(addressmultivalueref) > 0) { cfdictionaryref dict = abmultivaluecopyvalueatindex(addressmultivalueref, 0); city = (__bridge nsstring *)cfdictionarygetvalue(dict, kabpersonaddresscitykey); } nsstring *state; if (abmultivaluegetcount(addressmultivalueref) > 0) { cfdictionaryref dict = abmultivaluecopyvalueatindex(addressmultivalueref, 0); state = (__bridge nsstring *)cfdictionarygetvalue(dict, kabpersonaddressstatekey); } nsstring *zip; if (abmultivaluegetcount(addressmultivalueref) > 0) { cfdictionaryref dict = abmultivaluecopyvalueatindex(addressmultivalueref, 0); zip = (__bridge nsstring *)cfdictionarygetvalue(dict, kabpersonaddresscitykey); }

the same method can used kabpersonaddresscountrycodekey , kabpersonaddresscountrykey properties well.

don't forget link against addressbook framework , #import <addressbook/addressbook.h>

ios abaddressbook

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -