当我尝试存储新联系人的电话号码时,在下面的第一步中
let multiPhone : ABMutableMultiValueRef = ABMultiValueCreateMutable(kABMultiStringPropertyType)
给予
'int' is not convertible to 'ABPropertyType'
可能是,
func ABMultiValueCreateMutable(type: ABPropertyType) -> Unmanaged<ABMutableMultiValueRef>!
接受声明为 typealias ABPropertyType = UInt32
的 ABPropertyType,但是,
var kABMultiStringPropertyType: Int { get }
返回 Int 而不是 UInt32。
有什么解决方法吗?
最佳答案
func createMultiStringRef() -> ABMutableMultiValueRef {
let propertyType: NSNumber = kABMultiStringPropertyType
return Unmanaged.fromOpaque(ABMultiValueCreateMutable(propertyType.unsignedIntValue).toOpaque()).takeUnretainedValue() as NSObject as ABMultiValueRef
}
关于ios - swift : Issue with saving contact with AddressBook - (Xcode6-Beta5),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25204115/