an Objective-C wrapper for accessing a single keychain item, the sample code was originally created by Apple but now available in modified & modernized (for ARC) forms from a variety of sources.
Questions tagged [keychainitemwrapper]
96 questions
29
votes
8 answers
iOS Keychain writing value results in error code -34018
I have an iOS application that stores some sensitive information in the keychain.
While writing values into the keychain, I am getting error code -34018.
I am currently using Apple's iOS KeyChainItemWrapper class.
Both of the following lines of code…

Rohit Nisal
- 291
- 1
- 3
- 4
14
votes
2 answers
Saving in KeyChainItemWrapper crashes for password
Apple has provided KeyChainItemWrapper class in their GenericKeyChain sample code. There is an ARC'ed solution here on SO, which I am trying to follow: wrapper to store in the KeyChain on iOS.
The usage of the wrapper is like…

Houman
- 64,245
- 87
- 278
- 460
13
votes
1 answer
Keychain sometimes returns empty value
We are using native key-chain wrapper class to store and retrieve values from the key-chain. But in some case the value is getting deleted/empty.
We have the below items enabled in our app
Location service ON - Always state initially and user can…

Narayanan Ramamoorthy
- 826
- 5
- 18
12
votes
2 answers
is keychain in ios threadsafe?
I would like to add some items to the keychain using "secitemadd", but I need to know first, if this is thread safe.
I have read the documentation from apple, but I am unable to find anywhere stating if its thread-safe.

raghul
- 1,008
- 1
- 15
- 33
8
votes
2 answers
KeychainItemWrapper 'Couldn't add the Keychain Item.'
I want to store access token to keychain. But i got the error: Couldn't add the Keychain Item.'
I checked some posts on stackoverflow like:
Storing email in keychain impossible (KeychainItemWrapper)
MyCode:
let a =…

William Hu
- 15,423
- 11
- 100
- 121
8
votes
4 answers
Trying to use KeychainItemWrapper by Apple "translated" to Swift
Sigh, I have been working on this the whole afternoon... here is my nightmare:
I am trying to use the KeychainItemWrapper made by Apple. But I "translated" its Objective-C codes to Swift:
import Foundation
import Security
class…

leonard
- 2,337
- 4
- 22
- 26
8
votes
1 answer
SecItemAdd returning OSStatus code -50
I am trying to write to the keychain in iOS and whenever I try to write to the keychain while testing on my device, I am getting the -50 error code as the result of SecItemAdd.
I first tried to implement such a mechanism myself, and after getting…

Can Poyrazoğlu
- 33,241
- 48
- 191
- 389
8
votes
1 answer
Are account names (kSecAttrAccount) encrypted in iOS keychain?
Apple's GenericKeychain example saves a username and password in the iOS keychain. It does this using kSecAttrAccount for the username, and kSecValueData for the password.
Are all data items placed in the keychain encrypted, so including the…

meaning-matters
- 21,929
- 10
- 82
- 142
7
votes
1 answer
ios storing login token in KeyChain fails to retrieve, rarely and randomly, but consistently
I'm using the ios keychain (keychainItemWrapper / SSKeychain) to store my app's login token and maintain logged in state. Currently I store a simple NSDictionary in the keychain containing my token, a token expiry and a refresh token. I serialize…

Miro
- 5,307
- 2
- 39
- 64
6
votes
2 answers
What is the bundle seed id for an iOS app?
In order to share keychain information between applications, we needed to setup a shared keychain access group.
Before the sharing would work correctly, both apps needed to have provisioning based on the same bundle seed ID.
I wants to know what is…

kidsid49
- 1,358
- 3
- 18
- 37
5
votes
1 answer
Keychain Unit Tests fail when run on device or iOS target
I have an iOS project.
I have extracted some authentication code today and moved it to it's own project.
This project supports macOS and iOS.
I have created a workspace that contains both the iOS project and the Auth project and I have added the…

Harry Blue
- 4,202
- 10
- 39
- 78
5
votes
1 answer
Application is crashing when creating a options Dictionary used by addPersistentStoreWithType method
I am using encrypted-core-data to encrypts all data that is persisted , previously simple CoreData was using. persistentStoreCoordinator creation code are as follows .
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator {
if…

Ali AKhtar
- 161
- 2
- 12
5
votes
2 answers
KeychainItemWrapper crash on iOS10
When I try to add the item to Keychain i found this crash on iOS10
*** Assertion failure in -[KeychainItemWrapper writeToKeychain]
On iOS 9.3 I write the key in the keychain without problem
Thanks
user1784067
5
votes
2 answers
iOS Keychain Data Lost Upon iPhone Memory Pressure?
I'm running an iOS app via a debugger on my iPhone 5s. I'm using the keychain to store a password (I'm using the KeychainItemWrapper example from Apple to store and retrieve my keychain items). About 99.99% of the time, the keychain retrieval works…

ayl
- 384
- 1
- 5
- 14
4
votes
1 answer
KeychainItemWrapper Crashing for iOS8
I'm using KeychainItemWrapper for my application using the following line of code
KeychainItemWrapper *currentUser = [[KeychainItemWrapper alloc] initWithIdentifier:@"com.example" accessGroup:nil];
[currentUser setObject:accountString…

Karthik
- 934
- 9
- 21