Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading values from Keychain does not work when in Release mode #5

Open
moshegutman opened this issue Jan 19, 2015 · 2 comments
Open

Comments

@moshegutman
Copy link

I'm unable to read values from the Keychain when using the Swift compiler Optimization Level [Fastest -O], which is default for Release mode apps.

https://github.com/vandadnp/iOS-8-Swift-Programming-Cookbook/blob/master/chapter-security/Finding%20Values%20in%20the%20Keychain/Finding%20Values%20in%20the%20Keychain/AppDelegate.swift

Seems like these lines are the problem:

var returnedData: Unmanaged<AnyObject>? = nil
let results = Int(SecItemCopyMatching(query, &returnedData))

Possible solution:
http://stackoverflow.com/questions/24145838/querying-ios-keychain-using-swift

var returnedData: AnyObject?
var results = withUnsafeMutablePointer(&returnedData) { SecItemCopyMatching(query, UnsafeMutablePointer($0)) }
@vandadnp
Copy link
Owner

Hi there, what is the value in the results variable after you call the SecItemCopyMatching() function? Thanks.

@moshegutman
Copy link
Author

It is an OSStatus object. Upon success its value will be equal to errSecSuccess

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants