I'm making a simple dictionary, [ABPropertyID : String ]
:
let propertyToMethod = [
kABPersonInstantMessageProperty : "contactMethodInstantMessage",
kABPersonEmailProperty : "contactMethodEmail",
kABPersonPhoneProperty : "contactMethodPhoneCall" ]
This crashes at runtime with Dictionary literal contains duplicate keys
. Seems like the keys of type ABPropertyID
aren't resolved until runtime...? But either way, why would there be a duplicate among them when they're used to differentiate address book properties?
And also, why would they all be zero?:
println("kabIM: \(kABPersonInstantMessageProperty), kabEmail: \(kABPersonEmailProperty), kabPhone: \(kABPersonPhoneProperty)")
prints kabIM: 0, kabEmail: 0, kabPhone: 0
.
I was working under the impression that they were compile-time constants with unique values. This is how they are declared in the library:
let kABPersonEmailProperty: ABPropertyID // Email(s) - kABMultiStringPropertyType
...
typealias ABPropertyID = Int32
Running on iphone 5, 8.3.