Launch Application Warning Causing "Quits Unexpectedly"

Discussion in 'iOS Programming' started by peacetrain67, Jul 14, 2009.

  1. peacetrain67 macrumors member

    Joined:
    Dec 20, 2007
    #1
    I am trying to open my application to a ModalViewController (a log in page) opposed to the TabBarController that navigates the whole application. I have this code in the appdelegate:

    - (void)applicationDidFinishLaunching:(UIApplication *)application
    {
    LoginViewController *startapp = [[LoginViewController alloc] initWithNibName:nil bundle:nil];
    [self presentModalViewController:startapp];
    }

    I am getting a warning that reads "warning:'AppNameAppDelegate' may not respond to '-presentModalViewController:' (Messahes without a matching method signature will be assumed to return 'id' and accept '...' as arguments.) The applications quits unexpectedly when I build and run.

    On top of all this, I believe I need to add: [window addSubview:tabBarController.view]; somewhere in the same location, but obviously there could be hitches adding these two commands together. Please and thankyou for the help.
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    self is an AppNameAppDelegate and presentModalViewController: is an instance method of UIViewController, so you're calling it on the wrong class of object. Plus, the method you really want is presentModalViewController:animated:
     

Share This Page