Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-23-2012, 10:30 AM   #1 (permalink)
Survivor
 
Join Date: Jan 2012
Posts: 41
Sunny46 is on a distinguished road
Default Help using KeyChain

Hi, I have tried to put queries here sometimes I feel there are people who might be knowing the answers or suggestions at least but I have not got any answer yet from any post... although my posts have not been so dumb...

I have problem using Keychain, i am doing development in IOS5 and for using Keychain wrapper classes I need to have KeychainWrapper updated for ios5, I have someway found the keychain wrapper but I am trying to save the username and password in the keychain but I can not see its working... I write my code under as well... I want to delete the Keychain at somepoint as well but It does not work as well...

Code:
  if([self.username text])
            [keyChain setObject:[self.username text] forKey:(__bridge id)kSecAttrAccount];

if([self.password text])
            [keyChain setObject:[self.password text] forKey:(__bridge id)kSecValueData];

similarly when I want to check if username & password is in Keychain then I check

Code:
  
    [self.username setText:[keyChain objectForKey:(__bridge id)kSecAttrAccount]];
    [self.password setText:[keyChain objectForKey:(__bridge id)kSecValueData]];

for some reason it is not working... I am unable to get any output even if i try to Log the keychain values...

what might be wrong???

I found on internet that there is an other way you can store, retrieve and delete the keychain data by using
Code:
SFHFKeychainUtils.h & .m
but after trying to change the file from ios4 to ios5 version.. it is a big mess.. i can not upgrade this file either....


Help ???
Sunny46 is offline   Reply With Quote
Old 01-23-2012, 02:43 PM   #2 (permalink)
Registered Member
 
Join Date: Dec 2010
Location: Seattle, WA
Posts: 408
RickSDK is on a distinguished road
Default

I used this code and it worked:

[keychain setObject:username forKeyid)kSecAttrAccount];

username = [keychain objectForKeyid)kSecAttrAccount];

only difference is the __bridge. not sure what that is.

Other than that, are you using KeyChainItemWrapper.h?

and make sure you use the same idetifier when you init the keychain for both setting and getting.
__________________
Check out my apps

RickSDK is offline   Reply With Quote
Old 01-24-2012, 02:49 AM   #3 (permalink)
Survivor
 
Join Date: Jan 2012
Posts: 41
Sunny46 is on a distinguished road
Default

Thanks for answer, Yes I am using the KeychainItemWrapper...

and __bridge id is some idetntifier added to change the KeychainItemWrapper to work with ios5 or sdk5.

but it does not work..
Sunny46 is offline   Reply With Quote
Reply

Bookmarks

Tags
keychain, keychainwrapper, sfhfkeychainutils

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 381
10 members and 371 guests
7twenty7, Atatator, FrankWeller, glenn_sayers, iphonedevshani, MAMN84, mraalex, QuantumDoja, tim0504, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,674
Threads: 94,122
Posts: 402,907
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Atatator
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:48 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0