【发布时间】:2013-01-29 17:58:39
【问题描述】:
如果我尝试,我无法在 CFArrayGetValueAtIndex 获得社交资料信息(推特、脸书)。其他所有信息,如姓名、号码、www 我都知道了。我用 ABPersonCreateVCardRepresentationWithPeople 创建了一个 vCard,如果我尝试输出,我会得到如下信息:
BEGIN:VCARD
VERSION:3.0
PRODID:-//Apple Inc.//iOS 10.7.5//EN
N:lastname;Firstname;;;
FN:Firstname lastname
ORG:company;
TITLE:Jobtitle
item1.EMAIL;type=INTERNET;type=pref:my@mail.com
item1.X-ABLabel:Global
TEL;type=IPHONE;type=CELL;type=VOICE;type=pref:049651651561
item2.URL;type=pref:Www.com.com
item2.X-ABLabel:_$!<HomePage>!$_
X-SOCIALPROFILE;type=twitter;x-user=Twitteracc:http://twitter.com/Twitteracc
X-SOCIALPROFILE;type=facebook;x-user=Face.book:http://www.facebook.com/Face.book
END:VCARD
我尝试获取信息的代码是:
ABAddressBookRef book = ABAddressBookCreate();
ABRecordRef defaultSource = ABAddressBookCopyDefaultSource(book);
CFDataRef vCardData = (__bridge CFDataRef)[vCardString dataUsingEncoding:NSUTF8StringEncoding];
CFArrayRef vCardPeople = ABPersonCreatePeopleInSourceWithVCardRepresentation(defaultSource, vCardData);
ABRecordRef person = CFArrayGetValueAtIndex(vCardPeople, 0);
...人没有社交信息。后来我尝试附加社交信息,也是一个错误。它只有在我创建一个新的 ABPersonCreate() 时才有效......所以这是我的错误吗?或者它还不能工作?有什么想法吗?
【问题讨论】:
标签: xcode ios5 ios6 addressbook