in my app I have no problem withs saving/retrieving string values(like myTextField.text) into NSUserDefaults but whatever i do to store NSDictionary i coldn’t succeed. And i tried a lot of answer from this site+ Google. Can anyone please help? Here is my code too:
id result=[NSJSONSerialization JSONObjectWithData:data options:
NSJSONReadingMutableContainers error:&error];
NSLog(@"Result: %@", result);
NSDictionary *dict= [result objectForKey:@"message"];
//i want to store dict sub dictionary
*EDIT*Note:The dictionary contains a kind of array of objects, and the objects are all members of property list(NSString, NSDate, …)
What the other answers are trying to tell you is, you have to get rid of your (id). NSUserDefaults and the compiler will complain and throw warnings if you try and put an id into the user defaults. Try it out this way.