Locksmith icon indicating copy to clipboard operation
Locksmith copied to clipboard

Not working using XCode 8 and Swift 2.3

Open tarrgor opened this issue 8 years ago • 8 comments

Hello, we are using Locksmith in our App and it is a great tool for handling the keychain. Unfortunately, since the update to XCode 8 and Swift-2.3 it suddenly stopped working. Usually we are storing users login information in the keychain and it should get loaded on App start. Now it suddenly doesn't get loaded anymore.

In our podfile we are using:

pod 'Locksmith', :git => 'https://github.com/matthewpalmer/Locksmith.git', :branch => 'swift-2.3'

Some debugging turned out that the problem could be here:

` private func performSecureStorageAction(closure: PerformRequestClosureType, secureStoragePropertyDictionary: [String: AnyObject]) throws -> [String: AnyObject]? { var result: AnyObject? let request = secureStoragePropertyDictionary let requestReference = request as CFDictionaryRef

    let status = closure(requestReference: requestReference, result: &result)

    let statusCode = Int(status)

    if let error = LocksmithError(fromStatusCode: statusCode) {
        throw error
    }

`

In this code, statusCode gets a value of -25300, which causes an exception to be thrown.

tarrgor avatar Sep 16 '16 07:09 tarrgor

Just updated the swift-2.3 branch, so try again (weren't any changes that should affect this that much though).

Also maybe https://github.com/matthewpalmer/Locksmith/issues/147 will help?

matthewpalmer avatar Sep 17 '16 05:09 matthewpalmer

solution described in http://stackoverflow.com/questions/38456471/secitemadd-always-returns-error-34018-in-xcode-8-in-ios-10-simulator worked.

DBassel avatar Sep 17 '16 18:09 DBassel

Confirmed that @DBassel's link/solution worked for me. Using Xcode 8, Swift 2.3, Mac OS El Cap

zackshapiro avatar Sep 19 '16 17:09 zackshapiro

Yes for me the entitlement solution also worked. XCode 8 is weird ;-)

tarrgor avatar Sep 19 '16 17:09 tarrgor

I had the same problem, and the solution by enabling keychain sharing worked for me as well. However, is this really the correct solution to go with here? Keychain sharing is for sharing the keychain between separate apps as far as I know, so this seems like a workaround rather than a permanent solution...

fnakstad avatar Oct 06 '16 05:10 fnakstad

+1 for making an actual fix for this. Feels weird to turn on a feature you don't need to work around this.

M0rph3v5 avatar Oct 06 '16 09:10 M0rph3v5

Question is if this is really a bug in Locksmith, or in XCode 8? ;-)

tarrgor avatar Oct 06 '16 14:10 tarrgor

Yeah my colleague just explained it and it's basically a xcode bug where the simulator needs some form of entitlement to get code signed and thus access to the keychain...

M0rph3v5 avatar Oct 06 '16 16:10 M0rph3v5