I have an NSMutableArray
with keys UserID and UserName.
I also have an NSDictionary
with keys UserID and UserScore.
How do I add the key and values for UserScore from the NSDictionary
to the NSMutableArray
so that the UserName and UserScore represent the same UserID?
NSMutableArray:
UserID = 123,
UserName = JohnP
NSDictionary:
UserID = 123,
UserScore = 100
Desired output as NSMutableArray:
UserID = 123,
UserName = JohnP,
UserScore = 100
Below is how I retrieve data into the NSMutableArray
using Parse
and then grab data to a label:
[FBRequestConnection startWithGraphPath:@"/me/friends"
parameters:nil
HTTPMethod:@"GET"
completionHandler:^(
FBRequestConnection *connection,
id result,
NSError *error
) {
FacebookFriends = [result objectForKey:@"data"];
}];
NSString *friendname = [[NSString alloc] initWithFormat:@"%@",[[FacebookFriends objectAtIndex:indexPath.row] objectForKey:@"name"]];
I think you really just wanna use an NSMutableDictionary which is made to store value-key pairs.
You can give your mutable dictionary values from your other dictionary simply by pointing to its key-value (objectForKey).