Has anyone used Buzz Andersen's Simple iPhone Keychain code?

隐身守侯 提交于 2019-12-08 01:54:56

问题


You can find it here.

I'm trying to understand his sample code in order to write a simple program with that stores passwords into the keychain and retrieves them for login. Has anyone done this before? It would be most appreciated if I can see any examples you may have.


回答1:


There's really no code to demonstrate, he lists both calls there.

Heres's an example, for what it is worth:

NSError *error;

[SFHFKeychainUtils storeUsername:@"fred" andPassword:@"mypassword123" forServiceName:@"myService" updateExisting:YES error:&error];

NSString *storedPassword = [SFHFKeychainUtils getPasswordForUsername:@"fred" andServiceName:@"myService" error:&error];



回答2:


To other newbies that use this code as is and don't understand why it doesn't work. Notice that the ServiceName is different (First without capital - "myService" and second with capital: "MyService"), that's why it doesn't work. Make the ServiceName the same.



来源:https://stackoverflow.com/questions/1870000/has-anyone-used-buzz-andersens-simple-iphone-keychain-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!