carlbrown / pdkeychainbindingscontroller Goto Github PK
View Code? Open in Web Editor NEWMac OSX and iOS Keychain Access patterned after NSUserDefaults.
License: MIT License
Mac OSX and iOS Keychain Access patterned after NSUserDefaults.
License: MIT License
The PDKeychainBindingsController pod is listed as version 0.0.1 on cocoapods.org but in the repo it's 1.0.0. Do you plan on correcting this or know how I can work around it?
Hello there, I'd like to get my app working for iOS 8 and it appears that while I can write to the keychain and read from it in the same run in the simulator, when I re-start my app from the simulator the value is missing.
This was not the case for the iOS 7.1 simulator.
After running your tests for iOS, the last test fails. Not sure if it's related, but here's the output to the tests.
2014-06-06 14:55:03.621 PDKeychainBindingsControlleriOSExample[11590:258171] SetAppThreadPriority: setpriority failed with error 45
Test Suite 'All tests' started at 2014-06-06 18:55:04 +0000
Test Suite '/Users/seenickcode/Library/Developer/Xcode/DerivedData/PDKeychainBindingsController-ckokylkdryveqzeykbsbwkqeawbn/Build/Products/Debug-iphonesimulator/PDKeychainBindingsControlleriOSExampleTests.octest(Tests)' started at 2014-06-06 18:55:04 +0000
Test Suite 'PDKeychainBindingsTest' started at 2014-06-06 18:55:04 +0000
Test Case '-[PDKeychainBindingsTest testStandardBindingsExists]' started.
Test Case '-[PDKeychainBindingsTest testStandardBindingsExists]' passed (0.000 seconds).
Test Case '-[PDKeychainBindingsTest testStandardBindingsTalksToKeychain]' started.
2014-06-06 14:55:04.227 PDKeychainBindingsControlleriOSExample[11590:258171] Could not store(Add) string. Error was:-34018
/Users/seenickcode/Desktop/PDKeychainBindingsController-master/PDKeychainBindingsControlleriOSExampleTests/PDKeychainBindingsTest.m:65: error: -[PDKeychainBindingsTest testStandardBindingsTalksToKeychain] : '0' should be equal to '4294933278': Failed to retrive data, status was '-34018'
/Users/seenickcode/Desktop/PDKeychainBindingsController-master/PDKeychainBindingsControlleriOSExampleTests/PDKeychainBindingsTest.m:68: error: -[PDKeychainBindingsTest testStandardBindingsTalksToKeychain] : '' should be equal to '9018C564-A3BA-44C8-AA20-65015A0E3561' retrieved string from keychain '' not equal to expected 'foo'
2014-06-06 14:55:04.230 PDKeychainBindingsControlleriOSExample[11590:258171] Could not store(Delete) string. Error was:-34018
Test Case '-[PDKeychainBindingsTest testStandardBindingsTalksToKeychain]' failed (0.005 seconds).
Test Case '-[PDKeychainBindingsTest testStandardBindingsWorksAtAll]' started.
2014-06-06 14:55:04.232 PDKeychainBindingsControlleriOSExample[11590:258171] Could not store(Add) string. Error was:-34018
2014-06-06 14:55:04.235 PDKeychainBindingsControlleriOSExample[11590:258171] Could not store(Delete) string. Error was:-34018
Test Case '-[PDKeychainBindingsTest testStandardBindingsWorksAtAll]' passed (0.005 seconds).
Test Suite 'PDKeychainBindingsTest' finished at 2014-06-06 18:55:04 +0000.
Executed 3 tests, with 2 failures (0 unexpected) in 0.010 (0.010) seconds
Test Suite '/Users/seenickcode/Library/Developer/Xcode/DerivedData/PDKeychainBindingsController-ckokylkdryveqzeykbsbwkqeawbn/Build/Products/Debug-iphonesimulator/PDKeychainBindingsControlleriOSExampleTests.octest(Tests)' finished at 2014-06-06 18:55:04 +0000.
Executed 3 tests, with 2 failures (0 unexpected) in 0.010 (0.011) seconds
Test Suite 'All tests' finished at 2014-06-06 18:55:04 +0000.
Executed 3 tests, with 2 failures (0 unexpected) in 0.010 (0.011) seconds
Thanks,
Retrieving value from PDKeychain some time return nil. After rebooting the device its works fine. I'm not sure about the iOS version may be after 7.0 or higher.
Can you help in solving this issue ?
Thanks.
Can you create CocoaPods integration? It would make using keychain even more easier :)
Calling
[[PDKeychainBindings sharedKeychainBindings] removeObjectForKey:@"myKey"];
returns
Could not store(Delete) string. Error was:-25300
While investigating it, I've found that this is a custom NSLog
string, logged when the following operation fails:
OSStatus result=SecItemDelete((__bridge CFDictionaryRef)spec);
if (result!=0) {
NSLog(@"Could not store(Delete) string. Error was:%i",(int)result);
}
The error code from OSStatus
enum declared in <Security/SecBase.h>
has this description:
errSecItemNotFound = -25300, /* The specified item could not be found in the keychain. */
...which points out, that it's just the value being not found for respective key upon deleting.
I wonder, what option here would be more preferable?
PDKeychainBindingsController
has to have a fix to check the key, before deletingPDKeychainBindingsController
has to have a fix to make error codes processing and logging more accurateI was trying to get some info from keychain for a background sync but it kept having issues with nil values until I found out that it needs to be specified as accessibility.
http://stackoverflow.com/questions/10536859/ios-keychain-not-retrieving-values-from-background
I think this might be what is causing nil values for other people as well. Any plans of exposing that in your library? or do you want me to start on a pull request?
What is the best way to bind to the PDKeychainBindingsController within a nib? The example binds within code. Is there a simpler way then having a property point to the sharedKeychainBindingsController and binding to that within the nib? You could instantiate a PDKeychainBindingsController within the nib but then you could have multiple instances if you need access across different nibs.
Any chance of this being added? http://cocoapods.org/
Thanks for wrapping this up so conveniently! Adding it to CocoaPods would just add another level of convenience.
Hi there,
I am trying to use the library with swift and objectiveC (mix & match).
Here is my code in the swift file
var url:NSURL = NSURL(string: shopUrl.text)
var secureStore: PDKeychainBindings = PDKeychainBindings()
secureStore.setObject("url", forKey: "shopUrl")
var usernameSecured:NSString = NSString(string: username.text)
secureStore.setObject("usernameSecured", forKey: "username")
var passwordSecured:NSString = NSString(string: password.text)
secureStore.setObject("passwordSecured", forKey: "password")
Receiving an error "Could not store(Add) string. Error was:-34018". What would be the reason?
Thank you.
This works great in iOS 9.x in latest stable Xcode(7.3.1). The problem happens when I start to run with iOS 10 beta with Xcode 8 beta 3.
For some reason, when I'm trying to read entries saved by [[PDKeychainBindings sharedKeychainBindings] objectForKey:@"my_key"]
a nil
is coming back instead of the expected saved object.
[[PDKeychainBindings sharedKeychainBindings] setObject:@"stringvalue" forKey:@"my_key"]
is not reporting or causing any crashes.
Love this wrapper! I use CLANG macros to swap out the NSUserDefaults I was using with this instead; but, NSUserDefaults has a synchronize
method that this does not have. For all I know it's necessary and would have no purpose for keychain, in which case I propose adding the method w/ no contents so that projects that swap defaults out for this will compile without error!
Hey man,
I love your keychain library. It's so easy to implement. I'm working on my first project with keychain and through testing I've realized that the keychain data lives on even though the app is deleted. I'm cache user info and I'm not keeping a list of users outside of the keychain so I don't have a list of keys. I want to delete all of the keychain data so I was expecting a "removeAll" or at least an "allKeys" method that I could use to wipe out the data.
I started looking at the code and realized it would take me a bit just to follow along and I thought it might be an easy add for you.
Just a thought. Thanks for the great work!
-M.
I'm getting a warning:
PDKeychainBindingsController/PDKeychainBindingsController/PDKeychainBindingsController.m:131:13: Expression result unused
Which is coming from:
+ (PDKeychainBindingsController *)sharedKeychainBindingsController
{
@synchronized (self) {
if (sharedInstance == nil) {
[[self alloc] init]; // assignment not done here, see allocWithZone
}
}
return sharedInstance;
}
I get that the assignment happens over here:
+ (id)allocWithZone:(NSZone *)zone
{
@synchronized(self) {
if (sharedInstance == nil) {
sharedInstance = [super allocWithZone:zone];
return sharedInstance; // assignment and return on first allocation
}
}
return nil; //on subsequent allocation attempts return nil
}
Personally I think this is strange. Is there a specific reason for this pattern? Why not just do the assignment in the accessor method? At the very least we should just avoid the warning:
// assignment not done here, see allocWithZone
__unused id unused = [[self alloc] init];
Hi,
Is anybody here going to build PDKeychainBindingsController in Swift? It would be a nice thing to have.
Please, add link to Readme on this simple guide:
http://highaltitudehacks.com/2013/09/17/ios-dev-storing-info-in-keychain-with-nsuserdefaults-like-syntax/
Hi, I just have an app out there which has stopped working since iOS 8 release. :(
Google Analytics says that NSUnknownKeyException Trace: <redacted> <redacted> <redacted> -[DPEntity storeInKeychainWithPrefix:] -[BXUser populateFromKeychainOrWithDefaults] +[BX...
. I was using -[PDKeychainBindings setString:forKey:]
there. I was using a version from 2013 July, so the question is...
...were there any know issue with iOS 8 that is fixed in the most recent version of this repo?
It appears that you can store items in the keychain in such a way that when you ask for that item later, it shows the Touch ID prompt before giving you the value for that key. Is there any interest in adding support for Touch ID keychain values to this library?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.