我为什么要在这里崩溃?

时间:2011-04-07 19:33:30

标签: ios4 addressbook abaddressbook

名字,姓氏和电子邮件地址非常棒!一旦我得到解决,我就崩溃了。

            NSString *firstName =       (NSString *)ABRecordCopyValue(thisPerson, kABPersonFirstNameProperty);
            NSString *lastName  =       (NSString *)ABRecordCopyValue(thisPerson, kABPersonLastNameProperty);
            NSString *emailAddress  =   (NSString *)ABRecordCopyValue(thisPerson, kABPersonEmailProperty);
            NSString *address   =       (NSString *)ABRecordCopyValue(thisPerson, kABPersonAddressStreetKey);
            NSString *city      =       (NSString *)ABRecordCopyValue(thisPerson, kABPersonAddressCityKey);
            NSString *state     =       (NSString *)ABRecordCopyValue(thisPerson, kABPersonAddressStreetKey);
            NSString *zip       =       (NSString *)ABRecordCopyValue(thisPerson, kABPersonAddressZIPKey);

1 个答案:

答案 0 :(得分:2)

地址是MultiValue属性((a multivalue property of type kABMultiDictionaryPropertyType),您不能使用ABRecordRef对象直接访问它。

您首先需要获取该多值属性,然后使用此属性可以访问街道,城市和其他地址属性。