Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8177967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:39:15+00:00 2026-06-06T23:39:15+00:00

I want to save password when user select remember me checkbox. I have code

  • 0

I want to save password when user select remember me checkbox. I have code like this:is this correct?

In Appdelegate.m

@property(strong,nonatomic)NSString *savedno;

in .m file

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{    
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];

    // Override point for customization after application launch.
    self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];

    self.navcontrol =[[UINavigationController alloc]initWithRootViewController:self.viewController ];

    self.window.rootViewController = self.navcontrol;
    [self.window makeKeyAndVisible];

    self.savedno=[[NSUserDefaults standardUserDefaults]objectForKey:@"pass"];

    if(savedno==nil)
    {
        NSDictionary *saveDict=[NSDictionary dictionaryWithObject:savedno forKey:@"pass"];
        [[NSUserDefaults standardUserDefaults]registerDefaults:saveDict];
    }
    return YES;
}

- (void)applicationWillTerminate:(UIApplication *)application
{
    /*
     Called when the application is about to terminate.
     Save data if appropriate.
     See also applicationDidEnterBackground:.
     */

    NSUserDefaults *userdefault=[NSUserDefaults standardUserDefaults];
    [userdefault setObject:savedno forKey:@"pass"];
}

//ViewDelegate.m file

//event of checkbox

-(IBAction)check:(id)sender
{
    if (checkboxSelected == 0)
    {
        [checkboxButton setSelected:YES];
        [checkboxButton setImage:[UIImage imageNamed:@"checkbox-checked.png"]forState:UIControlStateNormal];

        // userdefault=[NSUserDefaults standardUserDefaults];
        // [userdefault setObject:user.text forKey:@"user"];
        // [userdefault setObject:pass.text forKey:@"pass"];
        self.callno=pass.text;
        pass.text=self.callno;
        AppDelegate *appdelegate=[[UIApplication sharedApplication]delegate];
        appdelegate.savedno=self.callno;

        NSLog(@"Data saved");    
        checkboxSelected = 1;        
    }
    else
    {
        [checkboxButton setSelected:NO];
        [checkboxButton setImage:[UIImage imageNamed:@"checkbox.png"]forState:UIControlStateNormal];                                 
        user.text=@"";
        pass.text=@"";
        checkboxSelected = 0;
    }
}

- (void)viewDidLoad
{
    user.clearButtonMode=UITextFieldViewModeWhileEditing;

    AppDelegate *appdel=[[UIApplication sharedApplication]delegate];

    if([user.text isEqualToString:@"bhoomi"])
    {
        pass.text=appdel.savedno;
    }
    [super viewDidLoad];

    checkboxSelected = 0;

    // Do any additional setup after loading the view, typically from a nib.
}
`
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T23:39:16+00:00Added an answer on June 6, 2026 at 11:39 pm

    use this code…

    NSUserDefault *userDefault = [NSUserDefaults standardUserDefaults];
    
    [userDefault  setValue:pass_str forKey:@"pass"];
    
    [userDefault  synchronize];
    

    may this will help you…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a user model like this: class User < ActiveRecord::Base validates :password, :presence
I want save the username and password when user login, and I added the
I want to provide the user the ability to save personal data encrypted. This
I am using idandersen's scifihifi-iphone code for keychain and save password using [SFHFKeychainUtils storeUsername:@User
In my User class I have the password which is SecureString. To save the
I want to be able to save the email and password of the user
i want to save a balance of user, in the user table . the
We're using authlogic, and we want to have a user accounted created and the
I have a model User and when I create one, I want to pragmatically
So I have the user enter password to signup from the android app. Before

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.