I have an NSDictionary and I have to add it to a NSArray. How can I do it?
NSDictionary *row = [NSDictionary dictionaryWithObjectsAndKeys:
[NSString stringWithFormat:@"%@",NSLocalizedString(@"no_favorites", nil)], @"Address", nil];
If I use:
aFavorite = [row allValues];
as sugested, if I print it I got:
(
"No favorites added"
)
What I need is:
(
{
Address = "No favorites added";
}
)
Because I will use:
NSDictionary* dict = [aFavorite objectAtIndex:[indexPath row]];
NSString *contentForThisRow = [dict objectForKey:@"Address"];
The dict value can have 1 or 2 keys.
To convert a Dictionary you can use it’s method:
UPDATE
When you want to add the dic in order to retrive it and use the key to retrive the value, use
NSMutableArraylike this:Then retrive the dic simply by using: