NSArray* nameArr = [NSArray arrayWithObjects: @"Jill Valentine", @"Peter Griffin", @"Meg Griffin", @"Jack Lolwut",
@"Mike Roflcoptor", @"Cindy Woods", @"Jessica Windmill", @"Alexander The Great",
@"Sarah Peterson", @"Scott Scottland", @"Geoff Fanta", @"Amanda Pope", @"Michael Meyers",
@"Richard Biggus", @"Montey Python", @"Mike Wut", @"Fake Person", @"Chair",@"subbu",@"reddy",@"suresh",@"harish",@"naresh",@"giri",@"nani",
nil];
for (i=0; i<=nameArr.count i++)
{
NSMutableDictionary *dic=[NSMutableDictionary new];
[dic setObject:@"nameArr" forKey:@"name"];
}
how to add namearr array to my dictionary
56 views Asked by subbu At
4
You are creating NSMutableDictionary object each and every time.
You should declare that object out side of for loop.
Here is the code
But clear the purpose as this code is not proper.
It states that you are compiling loop number of item array has, and you are adding same array to that dictionary on same key.