iPhone OSStatus -25308 or errSecInteractionNotAllowed SFHFKeychainUtils

Posted by George Octavio on Stack Overflow See other posts from Stack Overflow or by George Octavio
Published on 2010-04-20T18:47:25Z Indexed on 2010/04/20 18:53 UTC
Read the original article Hit count: 341

Filed under:
|

Hi again guys.

I'm trying to access my iPhone's device keychain. I want to access in order to create a simple user-password value intended for a log in function. This is the code I'm using from SFHFKeychainUtils

NSArray *keys = [[[NSArray alloc] initWithObjects: (NSString *) kSecClass, 
        kSecAttrService, 
        kSecAttrLabel, 
        kSecAttrAccount, 
        kSecValueData, 
        nil] autorelease];

  NSArray *objects = [[[NSArray alloc] initWithObjects: (NSString *) kSecClassGenericPassword, 
        serviceName,
        serviceName,
        @"TestUser",
        @"TestPass",
        nil] autorelease];

  NSDictionary *query = [[[NSDictionary alloc] initWithObjects: objects forKeys: keys] autorelease];   

  OSStatus status = SecItemAdd((CFDictionaryRef) query, NULL);
 }
 else if (status != noErr) {
        //Output to screen with error code goes here
  return NO;
 }

 return YES;
}

The error code I'm getting is OSStatus-25308 or errSecInteractionNotAllowed.

I'm guessing this means I don't actually have access to my iPhone's keychain? Is there a way to allow access?

Thanks for your time.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about keychain