I have a class that holds data such as username and password. These values are set from a viewcontroller with a text field. This class has methods that use the username and password that the user inputted to carry out certain tasks. How do I write my program so that the user only has to put their username and password once to use the methods in this other class? This way worked by using NSUserdefaults, but I want the data to go away every time a new app session is started. Any way I can accomplish this? Thanks!
In your AppDelegate.m file:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults removeObjectForKey:@"key1"];
[defaults removeObjectForKey:@"key2"];
[defaults removeObjectForKey:@"key3"];
return YES;
}