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 3807234
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T14:57:32+00:00 2026-05-19T14:57:32+00:00

I am attempting to compare two strings using isEqualToString and i cant seem to

  • 0

I am attempting to compare two strings using “isEqualToString” and i cant seem to get it to work. Once it begins to run the if statement it quits the app. I’m quite sure that the strings are in fact equal to each other and despite my best attempts I’m out of ideas. Any help would be appreciated.

-(void)createTextfields{
    name = [[UITextField alloc] initWithFrame:CGRectMake(10, 0, 140, 25)];
    name.borderStyle = UITextBorderStyleRoundedRect;
    name.textColor = [UIColor blackColor];
    name.placeholder = @"Password";
    name.textAlignment = UITextAlignmentCenter;
    [self addSubview:name];

    entry = [[UITextField alloc] initWithFrame:CGRectMake(170, 0, 140, 25)];
    entry.borderStyle = UITextBorderStyleLine;
    entry.textColor = [UIColor blueColor];
    entry.textAlignment = UITextAlignmentCenter;
    [self addSubview:entry];
}

-(void)createSubmitButton{
    UIButton *submit = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    submit.titleLabel.textAlignment = UITextAlignmentCenter;
    [submit setTitle:@"Submit" forState:UIControlStateNormal];
    submit.frame = CGRectMake(90, 50, 60, 30);
    [submit addTarget:self action:@selector(runSubmit) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:submit];


    UIButton *savePass = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    savePass.titleLabel.textAlignment = UITextAlignmentCenter;
    [savePass setTitle:@"Save" forState:UIControlStateNormal];
    savePass.frame = CGRectMake(20, 50, 60, 30);
    [savePass addTarget:self action:@selector(save) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:savePass];
}

-(void)save{

    tempPass = name.text;
    name.text = @"";
    entry.text = tempPass;

}

-(void)runSubmit{

//  password = name.text;

    if ([tempPass isEqualToString:name.text]) {
        //[viewController displayAlertFromViewControl];
    }else {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Correct" message:@"Alert" delegate: self cancelButtonTitle:@"Close" otherButtonTitles: nil];
        [alert show];
        [alert release];
    }


}
  • 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-05-19T14:57:33+00:00Added an answer on May 19, 2026 at 2:57 pm

    If you run your program with this menu item: Run -> Run with Performance Tool -> Zombies
    then Instruments will do all the hard work of tracking down the problem for you. It will show you which object was released early and where it was allocated.

    It is probably tempPass. Once you determine if that is the case, it would be best to make tempPass a property with a copy attribute and then use self.tempPass=name.text instead of just tempPass=name.text.

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

Sidebar

Related Questions

I'm attempting to compare two strings with is . One string is returned by
I am attempting to compare files in a directory using SML. Using the TextIO
I'm attempting to compare two tables of equal length with a function, since I
Attempting/struggling to get registration and sign-up working within an active admin project. I have
I am attempting to compare a bitwise clone object to its parent to check
I'm attempting to write a basic dna sequencer. In that, given two sequences of
I'm trying to work with an existing home grown implementation of click-once. Currently we
I'm attempting a simple test of binary file I/O using the STL copy algorithm
I've got an interesting issue with type comparison. I'm attempting to compare an implied
I'm new to ocUnit and I'm attempting to compare 2 arrays with the STAssertTrue

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.