2

When I'm trying to store phone number of my new contact, in first step below

let multiPhone : ABMutableMultiValueRef = ABMultiValueCreateMutable(kABMultiStringPropertyType)

gives

'int' is not convertible to 'ABPropertyType'

may be as,

func ABMultiValueCreateMutable(type: ABPropertyType) -> Unmanaged<ABMutableMultiValueRef>!

accepts ABPropertyType which is declared as typealias ABPropertyType = UInt32 but,

var kABMultiStringPropertyType: Int { get }

returns Int not UInt32.

Any workaround for this?

BaSha
  • 2,356
  • 3
  • 21
  • 38

1 Answers1

7
func createMultiStringRef() -> ABMutableMultiValueRef {
     let propertyType: NSNumber = kABMultiStringPropertyType
     return Unmanaged.fromOpaque(ABMultiValueCreateMutable(propertyType.unsignedIntValue).toOpaque()).takeUnretainedValue() as NSObject as ABMultiValueRef
}
jDutton
  • 941
  • 11
  • 13
Henk
  • 86
  • 1