ABRecordCopyValue返回0? [英] ABRecordCopyValue return 0 ?

查看:143
本文介绍了ABRecordCopyValue返回0?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试做的是获取所有联系人并依赖联系人 SocialProfileProperty ,在获得所有具有 SocialProfileProperty 的联系人后,我将进行简单的过滤要知道它是 Facebook,Twitter,..

What I trying to do, is get all contacts and relies if the contact have SocialProfileProperty or not, after get all this contacts that have SocialProfileProperty I will make simple filtration to know if it is Facebook,Twitter,..

在我发布这个问题之前,我整整一天试图找到解决这个问题的任何方法??

Before I post this question I west full day trying to find any solution for this problem ??

但允许返回0 ??

ABAddressBookRef addressBook;
CFErrorRef *erer = NULL;
addressBook = ABAddressBookCreateWithOptions(NULL, erer);
CFArrayRef _allPeople = ABAddressBookCopyArrayOfAllPeople(addressBook);
CFIndex _nPeople = ABAddressBookGetPersonCount(addressBook);
NSMutableArray *socialArray = [[NSMutableArray alloc] init];
ABMultiValueRef socialProfiles;
for (int i=0;i<_nPeople; i++) {
    ABRecordRef _person=CFArrayGetValueAtIndex( _allPeople,i);
    NSNumber *recordId = [NSNumber numberWithInteger:ABRecordGetRecordID(_person)];
    NSLog(@"%@",recordId);
    socialProfiles = ABRecordCopyValue(_person, kABPersonSocialProfileProperty);
    if (ABMultiValueGetCount(socialProfiles)>0) {
        [socialArray addObject:(__bridge id)(socialProfiles)];
    }
}
NSLog(@"%d",socialArray.count);


推荐答案

允许返回0,直到用户满意为止与本机的社交联系,这确实

It is allows return 0 ,until the user marge the Social contacts with native and this does

直到他试图删除Facebook帐户时才会发生,例如在这种情况下警报出现

not happened until he try to delete the Facebook account for example in that case alert appear

并询问你是否想要联系或不联系???其他明智的返回0值:)

and ask if u wanna to marge contacts or not ??? other wise return 0 values :)

因此,在用户使用本机联系人填充FaceBook联系人之前,此方法永远不会有效。

这篇关于ABRecordCopyValue返回0?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆