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

  • Home
  • SEARCH
  • 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 6532069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:57:18+00:00 2026-05-25T09:57:18+00:00

I’m new to iOS development, and I’m having a problem with reused view controllers.

  • 0

I’m new to iOS development, and I’m having a problem with reused view controllers.

My application has a login view and then a view with details of the user, I’m using navigation controller to navigate through them.
I login with username1…
When I touch the back button on details View I wish to go back to the login view (and this actually happens) if I try to login with username2 it opens the details view of the username1 (couse its kind of reused in the navigation controller`s stack).
when i pop a view from the navigation controller’s stack it just goes to back and its not deallocated…
How can I reset the info of the details view or something like that, or maybe reset the navigation controller’s stack?

here I show some code:

self.myVC = [[[myVC alloc] initWithNibName:@"MyVC" bundle:[NSBundle mainBundle]] autorelease];        

[self.navigationController popViewControllerAnimated:NO];
[self.navigationController pushViewController:self.myVC animated:NO];

Actually, I recently found an issue about the login, its related to the ASIHTTPRequest I’m using. I’m posting my login code so you guys can take a look…

-(IBAction)loginGivenUserName:(NSString *)username andPassword:(NSString *)password{

    NSURL *url = [NSURL URLWithString:@"http://foo.heroku.com/users/login.json"];
    ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
    [request setUsername:username];
    [request setPassword:password];
    [request setRequestMethod:@"POST"];
    [request setDelegate:self];
    [request startAsynchronous];

}

It works just fine for the first time the user logs in… But when it goes back and try to login again, it responses is code 200 with any parameters passed…

I’ve debugged already, it passes the parameters right, but the response is wrong, does this HTTPRequest save some kind of cookie?

Because, it grants the access but loads the last user’s data…

Again, it works just fine for the first time, if the user put some wrong parameters it blocks the login…

  • 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-25T09:57:18+00:00Added an answer on May 25, 2026 at 9:57 am

    I’m guessing you’re doing something like:

    [self.navigationController pushViewController:self.detailVC animated:YES];
    

    which, of course, means that you are caching the detail controller in one of your classes. The only way an old view can show up is if YOU give the old view to the navcon. The navcon retains the view controllers in its current stack – you don’t need to retain them yourself.

    Generally the way to push a view controller is like such:

    UIViewController* detailVC = [[[MyDetailVC alloc] init] autorelease];
    [self.navigationController pushViewController:detailVC animated:YES];
    

    The navigation controller will retain the detailVC until it gets popped off the stack, at which point it will get released, its retain count will go to 0, and it will get deallocated.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
Basically, what I'm trying to create is a page of div tags, each has
I've got a string that has curly quotes in it. I'd like to replace
I want use html5's new tag to play a wav file (currently only supported
I am currently running into a problem where an element is coming back from
We're building an app, our first using Rails 3, and we're having to build

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.