In previous versions of Xcode 6 and 7 with Swift, this syntax would work:
var secureItemValue: Unmanaged<AnyObject>? let statusCode: OSStatus = SecItemCopyMatching(keychainItemQuery, &secureItemValue) if statusCode == errSecSuccess { let opaquePointer = secureItemValue?.toOpaque() let secureItemValueData = Unmanaged<NSData>.fromOpaque(opaquePointer!).takeUnretainedValue()
However, the SecItemCopyMatching declaration has changed in Xcode 7 beta 4:
OLD: func SecItemCopyMatching(_ query: CFDictionary, _ result: UnsafeMutablePointer<AnyObject?>) -> OSStatus
NEW: func SecItemCopyMatching(_ query: CFDictionary!, _ result: UnsafeMutablePointer<Unmanaged<AnyObject>?>) -> OSStatus
... and now the type safeItemValue does not match.
The mechanism was confusing before extracting the result, and I hope that with a new declaration it will be somehow easier, but I do not know how to declare the correct type for the secureItemValue variable and extract the result.
ios swift xcode7 xcode7-beta4
Daniel
source share