You will first want to build a NSDictionary with the key/values you want.
Next, you could use something like Lockbox to store that NSDictionary to the keychain, using the provided setDictionary:forKey:
interface.
UPDATE: To change values stored in that dictionary, you only have to pass by a NSMutableDictionary
(that's the common way of doing):
NSMutableDictionary *mutableDict = [[LockBox dictionaryForKey:@"YourRefreshTokenDictionaryKey"] mutableCopy];
mutableDict[@"access_token"] = @"NewAccessToken";
[LockBox setDictionary:mutableDict forKey:@"YourRefreshTokenDictionaryKey"];
FYI, a NSMutableDictionary
is a subclass of NSDictionary
, so it's safe to save that back directly to the keychain!