title: Error saving in the keychain with iphone sdk
body: <p>I use the <a href="http://developer.apple.com/library/ios/#samplecode/GenericKeychain/Listings/Classes_KeychainItemWrapper_m.html" rel="noreferrer">Apple wraper for the keychain</a>, and try to save a item on it (running in simulator, ios 4.1).</p>
  
  <p>I have not experience with the keychain before.</p>
  
  <p>I get this error:</p>
  
  <blockquote>
    <p>Couldn't add the Keychain Item. Error - 25299</p>
  </blockquote>
  
  <p>In KeychainItemWrapper.m line 304:</p>
  
  <pre><code>// No previous item found; add the new one.
  result = SecItemAdd((CFDictionaryRef)[self dictionaryToSecItemFormat:keychainItemData], NULL);
  NSAssert( result == noErr, @"Couldn't add the Keychain Item." );
  </code></pre>
  
  <p>This is how I do the save:</p>
  
  <pre><code>- (void) saveKey:(NSString *)key value:(NSString *)value {
      KeychainItemWrapper *keyItem = [[KeychainItemWrapper alloc] initWithIdentifier:key accessGroup:nil];
      [keyItem setObject:value forKey:(id)kSecValueData];
      [keyItem release];
  }
  </code></pre>
  
  <p>And this are the values that the api try to save:</p>
  
  <pre><code>&lt;CFBasicHash 0x7231f60 [0x320d380]&gt;{type = mutable dict, count = 5,
  entries =&gt;
  2 : &lt;CFString 0x2e6eb98 [0x320d380]&gt;{contents = "labl"} = &lt;CFString 0x2fb018 [0x320d380]&gt;{contents = ""}
  3 : &lt;CFString 0x2e6efb8 [0x320d380]&gt;{contents = "v_Data"} = &lt;CFString 0x727de60 [0x320d380]&gt;{contents = "dit8"}
  4 : &lt;CFString 0x2e6ebc8 [0x320d380]&gt;{contents = "acct"} = &lt;CFString 0x2fb018 [0x320d380]&gt;{contents = ""}
  5 : &lt;CFString 0x2e6eb58 [0x320d380]&gt;{contents = "desc"} = &lt;CFString 0x2fb018 [0x320d380]&gt;{contents = ""}
  6 : &lt;CFString 0x2e6ebe8 [0x320d380]&gt;{contents = "gena"} = &lt;CFString 0x2ffd08 [0x320d380]&gt;{contents = "userCode"}
  }
  </code></pre>