Ios Swift:访问ABAddressBookRef的CfdicurerRef时出现问题

Ios Swift:访问ABAddressBookRef的CfdicurerRef时出现问题,ios,iphone,swift,ios8,abaddressbook,Ios,Iphone,Swift,Ios8,Abaddressbook,我在ObjC中收集了联系人的地址信息 ABMultiValueRef addressProperty = ABRecordCopyValue(contactRef, kABPersonAddressProperty); CFDictionaryRef dict = ABMultiValueCopyValueAtIndex(addressProperty, 0); if(dict) { NSString *street = (NSString *)CFDictionaryGe

我在ObjC中收集了联系人的地址信息

ABMultiValueRef addressProperty = ABRecordCopyValue(contactRef, kABPersonAddressProperty);
CFDictionaryRef dict = ABMultiValueCopyValueAtIndex(addressProperty, 0);
   if(dict)
   {
     NSString *street = (NSString *)CFDictionaryGetValue(dict, kABPersonAddressStreetKey);
   }
所以,等效的Swift代码是

let addressProperty : ABMultiValueRef = ABRecordCopyValue(contactRef, kABPersonAddressProperty).takeUnretainedValue() as ABMultiValueRef

    if let dict : CFDictionaryRef = ABMultiValueCopyValueAtIndex(addressProperty, 0).takeUnretainedValue() as? CFDictionaryRef
    {
     let street = CFDictionaryGetValue(dict,kABPersonAddressStreetKey)
    // Stuck here, among  CFString!, UnsafePointer<Void>, CFDictionaryRef ...
    }
让addressProperty:ABMultiValueRef=ABRecordCopyValue(contactRef,KabPersonalAddressProperty)。将UnrepainedValue()作为ABMultiValueRef
如果let dict:CFDictionaryRef=ab多值CopyValueAtIndex(addressProperty,0)。是否将UnrepainedValue()作为?cfyref
{
let street=CFDictionaryGetValue(dict,KabPersonalAddressStreetKey)
//卡在这里,在CFString!、UnsafePointer、CFDictionaryRef。。。
}

如何获取街道和其他类似信息?

您可以改用
NSDictionary
吗?(未测试)


哦,是的,它正在工作,我已经用dict.\uu conversion()修复了它,它正在将CFDictionaryRef转换为NSDictionary,但现在我要直接使用NSDictionary。谢谢
if let dict : NSDictionary = ABMultiValueCopyValueAtIndex(addressProperty, 0).takeUnretainedValue() as? NSDictionary
{
 let street = dict[kABPersonAddressStreetKey]
}