So I've just updated to Xcode 8 and converted my Swift 2.3 code to Swift 3, and I have an error in this line of code that wasn't in Swift 2.3:
func populateFrom(_ addressBook:ABAddressBook)
{
let allPeople = ABAddressBookCopyArrayOfAllPeople(addressBook).takeRetainedValue()
let nPeople = ABAddressBookGetPersonCount(addressBook)
for index in 0..<nPeople
{
let person:ABRecord = Unmanaged<ABRecord>.fromOpaque(OpaquePointer(CFArrayGetValueAtIndex(allPeople, index))).takeUnretainedValue()
}
}
Now the problem is in line let person:ABRecord = Unmanaged<ABRecord>.fromOpaque(OpaquePointer(CFArrayGetValueAtIndex(allPeople, index))).takeUnretainedValue()
Xcode tells me that 'fromOpaque' is unavailable: use 'fromOpaque(_:UnsafeRawPointer)' instead
. But I can't find that function Xcode is telling me to use, I can just find fromOpaque(value: UnsafeRawPointer)
which is the one I'm currently using.
How can I make this work?