I have an NSDictionary and I need to save and load it in memory. For example, it’s easy to save NSString in NSUserDefaults. Help me please 🙂
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
So long as the contents of your dictionary conforms to the requirements, you can use -[NSDictionary writeToFile:atomically:] or -[NSDictionary writeToURL:atomically:] to persist the dictionary and then use +[NSDictionary dictionaryWithContentsOfFile:] or +[NSDictionary dictionaryWithContentsOfURL:] to read the file back into the dictionary.
The MVCNetworking sample project includes some code that does this.