Reputation: 1801
My application is dealing with contacts data.
The phone label is retrieved as following
let locPhoneLabel : NSString = (ABMultiValueCopyLabelAtIndex(phones, numberIndex) != nil) ? ABMultiValueCopyLabelAtIndex(phones, numberIndex).takeUnretainedValue() as CFStringRef : ""
let phoneLabel:Unmanaged<CFString> = ABAddressBookCopyLocalizedLabel(locPhoneLabel)
I don't know how to convert phoneLabel to NSString?
Upvotes: 5
Views: 3650
Reputation: 5038
For me it only helped:
let locLabel : CFStringRef = (ABMultiValueCopyLabelAtIndex(phoneNumbers, i) != nil) ? (ABMultiValueCopyLabelAtIndex(phoneNumbers, i).takeUnretainedValue()) as CFStringRef : ""
let noteForThisNumber = String (ABAddressBookCopyLocalizedLabel(locLabel).takeRetainedValue())
Upvotes: 0
Reputation: 14857
Try this:
let phoneLabel = ABAddressBookCopyLocalizedLabel(locPhoneLabel)
.takeRetainedValue() as? NSString
There is a great post here if you are interested.Unmanaged from NSHipster.
Upvotes: 13