Swift (iOS 8 SDK) Convierta <ABMultiValueRef> no administrado a ABMultiValueRef
Necesito convertir el valor de retorno de esta función desde el marco de AddressBook:
ABRecordCopyValue(nil, kABPersonPhoneProperty)
a un valor de tipo ABMultiValueRef
Esta función está actualmente marcada como esta:
func ABRecordCopyValue(record: ABRecordRef!, property: ABPropertyID) -> Unmanaged<AnyObject>!
Entonces puedo convertirlo a No administrado así:
ABRecordCopyValue(person, kABPersonPhoneProperty) as Unmanaged<ABMultiValueRef>
Pero entonces, ¿cómo puedo obtenerlo como ABMultiValueRef para poder pasarlo a esta función?
func ABMultiValueGetIndexForIdentifier(multiValue: ABMultiValueRef!, identifier: ABMultiValueIdentifier) -> CFIndex
Hice esto:
let managedPhones = Unmanaged.fromOpaque(phones.toOpaque()).takeUnretainedValue() as ABMultiValueRef
Y sigo recibiendo este error del compilador:
Bitcast requires both operands to be pointer or neither
%89 = bitcast %objc_object* %88 to %PSs9AnyObject_, !dbg !325
LLVM ERROR: Broken function found, compilation aborted!
Command /Applications/Xcode6-Beta3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift failed with exit code 1