この関数の戻り値を AddressBook フレームワークから変換する必要があります。
ABRecordCopyValue(nil, kABPersonPhoneProperty)
タイプ ABMultiValueRef の値へ
この関数は現在、次のようにマークされています。
func ABRecordCopyValue(record: ABRecordRef!, property: ABPropertyID) -> Unmanaged<AnyObject>!
したがって、次のようにアンマネージドに変換できます。
ABRecordCopyValue(person, kABPersonPhoneProperty) as Unmanaged<ABMultiValueRef>
しかし、それを ABMultiValueRef として取得して、この関数に渡すにはどうすればよいでしょうか?
func ABMultiValueGetIndexForIdentifier(multiValue: ABMultiValueRef!, identifier: ABMultiValueIdentifier) -> CFIndex
これは私がしました:
let managedPhones = Unmanaged.fromOpaque(phones.toOpaque()).takeUnretainedValue() as ABMultiValueRef
そして、私はこのコンパイラエラーを取得し続けます:
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