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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:01:18+00:00 2026-05-31T04:01:18+00:00

I wrote simple UINavigationController based app with two ViewControllers; In the first view controller

  • 0

I wrote simple UINavigationController based app with two ViewControllers;

In the first view controller I have this code

-(IBAction)loadSecondView
{
    SecondView *secondView = [[SecondView alloc]init];
    [secondView setTotal:self.total];
    [self.navigationController pushViewController:secondView animated:YES];
    [secondView release];
    [self.navigationController popViewControllerAnimated:YES];
}

In the second view I have a label which is created programitacly.

.....

 [self.playerNameField addTarget:self 
                              action:@selector(textFieldFinished:) 
.....

- (IBAction)textFieldFinished:(id)sender
{
    [sender resignFirstResponder];
}

The problem is that I get app crash when done button of the keyboard is touched.

[SecondView performSelector:withObject:]: message sent to deallocated instance 0x522af60

I understand what the problem is, but I can’t figure out why this happens.

Correct me if I’m wrong.

SecondView *secondView = [[SecondView alloc]init]; // retain 1
[self.navigationController pushViewController:playersNames animated:YES]; //secondView have retain of 2
[secondView release]; // now secondView should have retain of 1
  • 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-31T04:01:20+00:00Added an answer on May 31, 2026 at 4:01 am

    Why are you push and then pop navigationcontroller, once you push the view should switch and playersName controller with its view should appear.

    Also it is not clear to me why you get instance of secondView but never use it.
    Pushing onto the navigationController should retain the controller, but seems that SecondView never get retain, and once you use it the previous controller has released it.

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

Sidebar

Related Questions

I wrote simple iOS app which countdown the time til midnight. I have single
For get device id in android sdk i wrote simple This code :: import
is possible this wrote simple, code is here: foreach (var friend in friends) {
I wrote simple custom validation on javascript based on this doc . I want
I wrote a simple Sinatra app that generate an image using rmagick from some
Im new on Dxpreince 10.(and don't think im expert on this) I wrote simple
I wrote a simple opengl application in C which plots sin(x). This is my
I wrote a simple web app to let user input data as they walk
I've wrote simple RMI code to learn how it works. While everything works fine
everyone I wrote simple music player, but I have one problem. I used ajax

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.