export - How to write Facebook/Twitter to address book in iOS? -
in app export data address book in order create new contact entries. can export want without problem, except facebook , twitter addresses. i'm lost on these two.
here's code i'm using export non-facebook/twitter data work:
abmutablemultivalueref multiphone = abmultivaluecreatemutable(kabmultistringpropertytype); abmultivalueaddvalueandlabel(multiphone, (__bridge cftyperef)(thephonemobile), kabpersonphonemobilelabel, null); abmultivalueaddvalueandlabel(multiphone, (__bridge cftyperef)(thephonehome), kabhomelabel, null); abrecordsetvalue(newperson, kabpersonphoneproperty, multiphone, null); cfrelease(multiphone);
here's how i'm trying export facbeook not work:
abmutablemultivalueref multisocial = abmultivaluecreatemutable(kabmultistringpropertytype); abmultivalueaddvalueandlabel(multisocial, (__bridge cftyperef)(thefacebook), kabpersonsocialprofileservicefacebook, null); abrecordsetvalue(newperson, kabpersonsocialprofileproperty, multisocial, null); cfrelease(multisocial);
where going wrong?
setting social profiles tricky reason, here code necessary doing so:
abmultivalueref multisocial = abmultivaluecreatemutable(kabmultidictionarypropertytype); abmultivalueaddvalueandlabel(multisocial, (__bridge cftyperef)([nsdictionary dictionarywithobjectsandkeys:(nsstring *)kabpersonsocialprofileservicefacebook, kabpersonsocialprofileservicekey, thefacebook, kabpersonsocialprofileusernamekey,nil]), kabpersonsocialprofileservicefacebook, null); abrecordsetvalue(newperson, kabpersonsocialprofileproperty, multisocial, null);
according documentation, social profiles kabmultidictionarypropertytype, not kabmultistringtype.
that means need add dictionaries multisocial
, not strings. format not make sense me dictionary, copy , paste whenever need use it.
then, set how did before.
Comments
Post a Comment