views:

126

answers:

0

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?