jrendel / SwiftKeychainWrapper

A simple wrapper for the iOS Keychain to allow you to use it in a similar fashion to User Defaults. Written in Swift.
MIT License
1.59k stars 340 forks source link

iOS 10 Simulator, OSStatus error -34018 #59

Closed jrendel closed 7 years ago

jrendel commented 8 years ago

Getting OSStatus error -34018 on unit tests while trying to finalize the Swift 3.0 version of the library, so I'm opening this to track what I find.

So far some info here at the end: https://forums.developer.apple.com/thread/4743

Suggested workaround: https://forums.developer.apple.com/message/170381#170381

jrendel commented 8 years ago

The suggested fix to enable the Keychain Sharing entitlement doesn't work here since its not an option on a Framework target.

Installing the iOS 9.3 simulators and running tests against that works, so I'm going to move forward with that for now when running tests.

jrendel commented 8 years ago

Similar issue/solution discussed here: https://github.com/jrendel/SwiftKeychainWrapper/issues/66#issuecomment-251249507

jrendel commented 8 years ago

I have solved this in the latest changes by adding an entitlements file (for debug only) that allows the keychain to work under iOS 10 simulators. The entitlement simple adds a get-task-allow true flag to a test app and the unit test target uses that as its host app.

If you are running into similar issues in your project using the keychain wrapper, you can add a similar entitlements file to your main project. If you use an entitlements file with get-task-allow true in it, I would only add it as a debug entitlement.

Alternatively, if you enable any app capabilities that generates an entitlements file, that should be sufficient.

deni2s commented 8 years ago

Xcode 8.2 beta fixed problems on simulator on iOS 10:

Keychain APIs work correctly in Simulator. (28338972)

http://adcdownload.apple.com/Developer_Tools/Xcode_8.2_beta/Release_Notes_for_Xcode_8.2_beta.pdf

jrendel commented 8 years ago

Good to know!

jrendel commented 7 years ago

This issue has been fixed in Xcode 8.2.