
How to work with NSDictionary in Objective C?

Working with NSDictionary in Objective C Basically, in Objective C NSDictionary is used to create and retrive the Key values for objectecs. It's very simple to create and retrive the key values using NSDictionary .. please see the given example of NSDictionary
// Creating NSDictionary
NSDictionary *dic = [[NSDictionary alloc] initWithObjectsAndKeys:
@"userName", @"USER1", @"password",
@"PASS1", nil]; //nil to signify end of objects and keys.
// Access the dictionary value
NSLog(@"%@", [dic objectForKey@"password");
// Must Release NSDictionary
[dic release];
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.