I have value in 1 string for particular key.
but NSUserDefault class method doesn’t work properly and it doesn’t set object of a string forkey .
in short setobject forkey method is not working of NSUserDefault class.
why is it so?
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.
First of all, NSUserDefault class works just fine. It is called millions of times every day and works exactly as expected. The next likely culprit is your code. If you post that, it will be much easier to determine what you’re doing wrong, and to make an appropriate suggestion.
(Edit added after OP’s comment)
I just added this code:
to my project and ran it and everything worked just fine.
As I stated above: NSUserDefault works like a champ. There’s something you’re not telling us about your use-case. Something important. 😉