从ABRecord获取电话号码的正确方法

时间:2014-10-08 23:30:13

标签: objective-c macos abaddressbook abrecord

我正在尝试从ABRecord对象获取电话号码,但它目前无法正常工作。这是我正在尝试的代码

ABRecord *record = contactsArr[row];

NSString *home;
NSString *iPhone;
NSString *main;
NSString *work;
NSString *mobile;

ABMutableMultiValue *multiValue = [record valueForProperty:kABPhoneProperty];
ABMutableMultiValue *multiValue2 = [record valueForProperty:kABPhoneHomeLabel];
ABMutableMultiValue *multiValue3 = [record valueForProperty:kABPhoneiPhoneLabel];
ABMutableMultiValue *multiValue4 = [record valueForProperty:kABPhoneMainLabel];
ABMutableMultiValue *multiValue5 = [record valueForProperty:kABPhoneMobileLabel];
ABMutableMultiValue *multiValue6 = [record valueForProperty:kABPhoneWorkLabel];

if ([multiValue valueAtIndex:0]) {
        numberString = [multiValue valueAtIndex:0];
}

if ([multiValue3 valueAtIndex:0]) {
            iPhone = [multiValue valueAtIndex:0];
        }

这些是我在输出中遇到的错误。

[7260:278597] -[ABPerson valueForProperty:_$!<Home>!$_] - unknown property. This    warning will be displayed only once per unknown property, per session.
[7260:278597] -[ABPerson valueForProperty:iPhone] - unknown property. This warning will be displayed only once per unknown property, per session.
[7260:278597] -[ABPerson valueForProperty:_$!<Main>!$_] - unknown property. This warning d[7260:278597] -[ABPerson valueForProperty:_$!<Mobile>!$_] - unknown property. This warning will be displayed only once per unknown property, per session.
[7260:278597] -[ABPerson valueForProperty:_$!<Work>!$_] - unknown property. This warning will be displayed only once per unknown property, per session.

从ABRecord / Person获取每种电话记录的电话号码的正确方法是什么?我目前可以通过常规电话号码获取,但不能从具体电话号码中获取。

0 个答案:

没有答案