You'd rather use the Keychain to store the password and Preferences to store user login.
Search for SFHFKeychainUtils.h (Created by Buzz Andersen on 10/20/08) for a class that allows you to perform simple keychain operation (and being able to perform them on the iPhone Simulator).
To store the user login:
NSString *defaultUsername = ...;
[[NSUserDefaults standardUserDefaults] setObject:myUserName forKey:@"myServiceUserName"];
To store the password:
NSError *wsError;
NSString *defaultUsername = ...
if (defaultUsername && [defaultUsername length] != 0) {
[SFHFKeychainUtils storeUsername:defaultUsername andPassword:pass forServiceName:@"MyService" updateExisting:YES error:&wsError];
if (wsError != nil) {
NSLog(@"Could not store password into keychain. Error: %@", [wsError localizedDescription]);
}
}