@@ -89,7 +89,7 @@ class ViewController: UIViewController, ABPeoplePickerNavigationControllerDelega
89
89
}
90
90
91
91
var moi : ABRecord ! = nil
92
- let matts = ABAddressBookCopyPeopleWithName ( self . adbk, " Matt " ) . takeRetainedValue ( ) as NSArray
92
+ let matts = ABAddressBookCopyPeopleWithName ( self . adbk, " Matt " ) . takeRetainedValue ( ) as [ AnyObject ]
93
93
// could have asked for "Matt Neuburg" but I wanted to show how to cycle thru the results
94
94
for matt in matts {
95
95
if let last = ABRecordCopyValue ( matt, kABPersonLastNameProperty) . takeRetainedValue ( ) as? String {
@@ -105,10 +105,10 @@ class ViewController: UIViewController, ABPeoplePickerNavigationControllerDelega
105
105
}
106
106
// parse my emails
107
107
let emails : ABMultiValue = ABRecordCopyValue (
108
- moi, kABPersonEmailProperty) . takeRetainedValue ( ) as ABMultiValue
108
+ moi, kABPersonEmailProperty) . takeRetainedValue ( )
109
109
for ix in 0 ..< ABMultiValueGetCount ( emails) {
110
110
let label = ABMultiValueCopyLabelAtIndex ( emails, ix) . takeRetainedValue ( ) as String
111
- let value = ABMultiValueCopyValueAtIndex ( emails, ix) . takeRetainedValue ( ) as String
111
+ let value = ABMultiValueCopyValueAtIndex ( emails, ix) . takeRetainedValue ( ) as! String
112
112
println ( " I have a \( label) address: \( value) " )
113
113
}
114
114
}
@@ -122,7 +122,7 @@ class ViewController: UIViewController, ABPeoplePickerNavigationControllerDelega
122
122
let snidely : ABRecord = ABPersonCreate ( ) . takeRetainedValue ( )
123
123
ABRecordSetValue ( snidely, kABPersonFirstNameProperty, " Snidely " , nil )
124
124
ABRecordSetValue ( snidely, kABPersonLastNameProperty, " Whiplash " , nil )
125
- let addr : ABMutableMultiValue = ABMultiValueCreateMutable (
125
+ let addr : ABMultiValue = ABMultiValueCreateMutable (
126
126
ABPropertyType ( kABStringPropertyType) ) . takeRetainedValue ( )
127
127
ABMultiValueAddValueAndLabel ( addr
, " [email protected] " , kABHomeLabel
, nil )
128
128
ABRecordSetValue ( snidely, kABPersonEmailProperty, addr, nil )
@@ -160,9 +160,9 @@ class ViewController: UIViewController, ABPeoplePickerNavigationControllerDelega
160
160
println ( " WTF " ) // shouldn't happen
161
161
return
162
162
}
163
- let emails : ABMultiValue = ABRecordCopyValue ( person, property) . takeRetainedValue ( )
163
+ let emails : ABMultiValue = ABRecordCopyValue ( person, property) . takeRetainedValue ( )
164
164
let ix = ABMultiValueGetIndexForIdentifier ( emails, identifier)
165
- let email = ABMultiValueCopyValueAtIndex ( emails, ix) . takeRetainedValue ( ) as String
165
+ let email = ABMultiValueCopyValueAtIndex ( emails, ix) . takeRetainedValue ( ) as! String
166
166
println ( email) // do something with the email here
167
167
// self.dismissViewControllerAnimated(true, completion: nil)
168
168
}
@@ -176,7 +176,7 @@ class ViewController: UIViewController, ABPeoplePickerNavigationControllerDelega
176
176
}
177
177
178
178
let snides = ABAddressBookCopyPeopleWithName (
179
- self . adbk, " Snidely Whiplash " ) . takeRetainedValue ( ) as Array < ABRecord >
179
+ self . adbk, " Snidely Whiplash " ) . takeRetainedValue ( ) as [ AnyObject ]
180
180
if snides. count == 0 {
181
181
println ( " no Snidely " )
182
182
return
0 commit comments