When using Objective-C, we usually use the following code to get information
NSString *firstName = (__bridge_transfer NSString *)ABRecordCopyValue(contactPerson, kABPersonFirstNameProperty);
In Swift, I tried the following
var firstName : NSString = ABRecordCopyValue(contactPerson, kABPersonFirstNameProperty).takeUnretainedValue() as NSString
and I can’t build because of an error
Bitcast requires both operands to be pointer or neither
% 224 = bitcast% objc_object *% 223 to% PSs9AnyObject_,! Dbg! 486
Bitcast requires both operands to be pointer or neither
% 225 = bitcast% PSs9AnyObject_% 224 to i8 *,! Dbg! 486
LLVM ERROR: Broken function found, compilation aborted!
Command /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift failed with exit code 1
source
share