To create a dictionary which contain an array below tutorial will help you.
In this blog firstly we create a NSArray which contain some value and after that I have displayed all the value and then created a NSMutableDictioary and provide a key to the array1 and after that display the dictionary. In this way you can create a dictionary which contain the array.
NSArray *array1 = [NSArray arrayWithObjects:@"Lalit",
[NSNumber numberWithInteger:13],
[NSArray arrayWithObjects:@"Mohan",@"Sharma",nil],
nil];
NSLog(@"The array contain the following element %@",array1);
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
[dict setObject:array1 forKey:@"data"];
NSLog(@"the dictionary is %@",dict);
0 Comment(s)