keychainitemwrapper

iOS7: How to store a key / bool value in keychain

妖精的绣舞 提交于 2020-01-06 18:39:09
问题 I implement in-app purchases and all the products are non-consumable. My intention is to store bool values in the keychain for every product identifier, and later control the Core Data retrieves according to the stored bool values. My question is: How can I store key/bool values into the keychain? P.S: I use KeyChainItemWrapper. 回答1: Store it in form of NSNumber as it contains a special method + numberWithBool: to convert BOOL value to an object: [keychainItemWrapper setObject:[NSNumber

Trying to use KeychainItemWrapper by Apple “translated” to Swift

本秂侑毒 提交于 2020-01-01 03:13:08
问题 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 MyKeychainItemWrapper: NSObject { var keychainItemData: NSMutableDictionary? var genericPasswordQuery: NSMutableDictionary = NSMutableDictionary() init(identifier: String, accessGroup: String?) { super.init() // Begin Keychain search setup. The genericPasswordQuery

Saving in KeyChainItemWrapper crashes for password

南笙酒味 提交于 2019-12-31 10:39:44
问题 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 this: KeychainItemWrapper *keychain = [[KeychainItemWrapper alloc] initWithIdentifier:@"F11-email-auth" accessGroup:nil]; [keychain setObject:[emailTextfield text] forKey:(__bridge id)(kSecMatchEmailAddressIfPresent)]; [keychain setObject:[passwordTextfield text] forKey:

KeychainItemWrapper not getting loaded on iOS 9 OSStatus -34018 (errSecMissingEntitlement)

流过昼夜 提交于 2019-12-24 03:07:44
问题 I've been using KeychainItemWrapper just fine. But since I've updated my phone to iOS 9, it doesn't store the sessionID for some reason. + (BOOL)createKeychainValue:(NSString *)value forIdentifier:(NSString *)identifier { NSMutableDictionary *dictionary = [self setupSearchDirectoryForIdentifier:identifier]; NSData *valueData = [value dataUsingEncoding:NSUTF8StringEncoding]; [dictionary setObject:valueData forKey:(__bridge id)kSecValueData]; // Protect the keychain entry so it's only valid

Storing access token and refresh token in KeyChain

こ雲淡風輕ζ 提交于 2019-12-14 02:34:37
问题 I would like to know how to effectively store the access token, refresh tokens and their expirations in the iOS keychain. All the examples I have seen seem to store only one key-value combination. How do we store multiple key values for one keychain identifier? If there is a better way to store the above, please let me know. 回答1: You will first want to build a NSDictionary with the key/values you want. Next, you could use something like Lockbox to store that NSDictionary to the keychain,

About ios KeychainItemWrapper store username/password other than object

倖福魔咒の 提交于 2019-12-12 23:23:03
问题 I know save username/password use KeychainItemWrapper class method below, but I want an additional [ipTF text] in KeychainItemWrapper. How to do it? KeychainItemWrapper *keychainItem = [[KeychainItemWrapper alloc] initWithIdentifier:@"Login" accessGroup:nil]; [keychainItem setObject:[useridTF text] forKey:(__bridge id)(kSecAttrAccount)]; [keychainItem setObject:[passTF text] forKey:(__bridge id)(kSecValueData)]; [keychainItem setObject:[ipTF text] forKey:@"ip"];//not success! 回答1: I don't

iOS Keychain Data Lost Upon iPhone Memory Pressure?

☆樱花仙子☆ 提交于 2019-12-12 12:11:11
问题 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 perfectly. However, there have been two cases in which my application could not get the password. For example, once, my phone was experiencing memory pressure and I had to restart the phone and relaunch the app. Upon the app relaunch, my app could

How can we save NSArray using KeychainItemWrapper class(ARC)

孤人 提交于 2019-12-11 14:29:30
问题 I want to save NSArray using KeychainItemWrapper class I have come to know that we can store the NSDictionary after reading This Question But its not working This is what I have done so far NSArray *myArray = [[NSArray alloc]initWithObjects:@"Hello1",@"Hello2",@"Hello3",@"Hello4", nil]; NSDictionary *myDic = [[NSDictionary alloc]initWithObjectsAndKeys:myArray, @"arrayKey", nil]; NSString *error; NSData *dictionaryRep = [NSPropertyListSerialization dataFromPropertyList:myDic format

how to save bool value in KeychainItemWrapper

懵懂的女人 提交于 2019-12-11 02:16:20
问题 I want to store bool value in KeychainItemWrapper, how to store ? I have tried this code, but it gives me error. [keychain setObject:YES forKey:(__bridge BOOL)kSecAttrIsInvisible]; 回答1: The BOOL is a primitive type and the setObject:forKey: only excepts classes that derive from NSObject . So use NSNumber it has a special method for it + numberWithBool:: [keychain setObject:[NSNumber numberWithBool:YES] forKey:@"someKey"]; And if you need to bool again: NSNumber *value = [keychain objectForKey

“SwiftKeychainWrapper.framework code signing failed” while distributing .ipa

て烟熏妆下的殇ゞ 提交于 2019-12-11 00:48:28
问题 When I want to distribute my .ipa file, I'm getting "code signing failed" error. After I updated my Xcode version to 10.0, this problem occured. Is there anyone that had this problem before ? The distribution standard log: code = 330; description = "Failed to resolve linkage dependency SwiftKeychainWrapper x86_64 -> @rpath/libswiftUIKit.dylib: Unknown arch x86_64"; info = { }; level = WARN; }, { code = 306; description = "Failed to resolve rpath for SwiftKeychainWrapper: Could not resolve