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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:59:45+00:00 2026-05-27T17:59:45+00:00

I am creating a basic navigation based application and am seeing an exc_bad_access error.

  • 0

I am creating a basic navigation based application and am seeing an exc_bad_access error. Can some one please point me what is wrong? I have just 2 screens and here is the code I am using:

in AppDelegate.m

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

  UINavigationController *navcon = [[UINavigationController alloc]init];
  psLaunchVC* pvc = [[psLaunchVC alloc]init];
  [navcon pushViewController:pvc animated:NO];

  [self.window addSubview:navcon.view];
    [self.window makeKeyAndVisible];
    return YES;
}

psLaunchVC comes up fine as the first screen.
I am trying to launch psTipVC from psLaunchVC.

psLaunchVC has an action declared in .h as

-(IBAction)showTip:(id)sender;

and implemented in .m as

- (IBAction) showTip:(id)sender
{
  // psTipVC *pst = [[psTipVC alloc]init];

  psTipVC *pst = [[psTipVC alloc]initWithNibName:@"psTipVC" bundle:nil];

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

}

The showTip is connected in IB as action for touchUpInside. However, when this code is executed, I see an exc_bad_access error. Can some one help me what is wrong here? is self.navigationController the right way to access the nav controller?

Declarations for reference:

@interface psLaunchVC : UIViewController 
@interface psTipVC : UIViewController

Actual error message:

2011-12-29 00:03:13.739 passport[633:707] -[__NSCFString showTip:]: 
     unrecognized selector sent to instance 0x18f5e0
2011-12-29 00:03:13.748 passport[633:707] 
          *** Terminating app due to uncaught exception 
          'NSInvalidArgumentException', 
          reason: '-[__NSCFString showTip:]: 
          unrecognized selector sent to instance 0x18f5e0'
  • 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-27T17:59:46+00:00Added an answer on May 27, 2026 at 5:59 pm

    The message you’re getting looks like psLaunchVC has been released and the outlet is pointing to garbage. Are you perhaps compiling this with ARC enabled? If so, your navigation controller is most likely getting released out from underneath you when application: didFinishLaunchingWithOptions: returns as it’s not retained by anyone. Try reworking that method to look like this:

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
      self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    
      psLaunchVC* pvc = [[psLaunchVC alloc]init];
      UINavigationController *navcon = [[UINavigationController alloc]initWithRootViewController:pvc];
    
      self.window.rootViewController = navcon;
      [self.window makeKeyAndVisible];
      return YES;
    }
    

    UIWindow really wants a rootViewController, not just the view to display. Also, initWithNibName:bundle: is the designated initializer for UIViewControllers, psLaunchVC should really be init’d with that instead.

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

Sidebar

Related Questions

I'm creating a basic database application in WPF, and I have started using the
I currently do a lot of WPF development and have started creating some basic
After creating a basic REST service, I've have come to the point where it
I am creating a basic image browsing application using Silverlight. Depending on the user's
I'm creating a basic forum where every message contains the authors name, some text
My current class is planning on creating a basic networked game, but we have
The basic setup is classic - you're creating a Windows Forms application that connects
First off I'm new at programming. I'm creating an app with one navigation bar
I'm creating some basic work assistance utilities using Ruby. I've hit a problem that
I'm creating a basic Struts2, Maven webApp and getting this error when I deploy

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.