I want to store username and password in keychain. As far I have explored we can store it and retrieve it like this

**Store username and password**

```
[_keychainObject setObject:username forKey:(id)kSecAttrAccount];
[_keychainObject setObject:password forKey:(id)kSecValueData];

```

**Retrieve username and password**

```
NSLog(@"%@", [_keychainObject objectForKey:(id)kSecAttrAccount]);
NSLog(@"%@", [_keychainObject objectForKey:(id)kSecValueData]);

```

Why can't we store it like this

```
[_keychainObject setObject:username forKey:@"username"];

```

If I do so its not storing the data. Is it mandatory to use predefined keys to store an item in keychain?