Ha, just find out how to do it myself. It is much easier to do this than to put a field in the preference. Only two lines are needed.
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:@"test" forKey:@"greeting"];
Next time, your app can get the value for the key "greeting".
Great!
Quote:
Originally Posted by danioyuan
I'm trying to make an app with In-App-Purchase. And if a user purchase the pro levels, I want to use the NSUserDefaults to record that. However, the examples of NSUserDefaults I found are all editable fields in the Preference.
Can anyone tell me how to create an item in the NSUserDefaults that a user cannot see/edit in the Preference? Also, can I add items to NSUserDefaults in my app instead of creating it in the plist before compilation?
Thanks a lot!!!!
|