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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:01:08+00:00 2026-05-23T07:01:08+00:00

I have an iOS application for which I want to create a ViewController programmatically.

  • 0

I have an iOS application for which I want to create a ViewController programmatically.

I started an empty XCode project and modified the main method so it looks like this

int main(int argc, char *argv[])
{
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    int retVal = UIApplicationMain(argc, argv, nil, @"MyAppDelegate_iPad");
    [pool release];
    return retVal;
}

The app is a Universal Application, MyAppDelegate_iPad is a subclass of MyAppDelegate, which is a subclass of NSObject <UIApplicationDelegate>.

My problem is that the applicationDidFinishLoading method I’ve overridden in MyAppDelegate_iPad is never called (break point on the first line never hits). The method looks like this

-(void) applicationDidFinishLaunching:(UIApplication *)application {
    window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    if(!window)
    {
        [self release];
        return;
    }
    window.backgroundColor = [UIColor whiteColor];

    rootController = [[MyViewController alloc] init];

    [window addSubview:rootController.view];
    [window makeKeyAndVisible];
    [window layoutSubviews];
}

I removed the line to link to a nib file from my plist file (I used to get the default “My Universal app on iPad” white screen) and now all that is displayed is a black screen. applicationDidFinishLoading is still not being called.

Am I doing something wrong? How should I properly create my AppDelegate instance?

  • 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-23T07:01:08+00:00Added an answer on May 23, 2026 at 7:01 am

    There’s a main nib file that bootstraps your application. This nib file is referenced in the Info.plist file under the NSMainNibFile key and should contain an object that corresponds to your application delegate class (setting the Class attribute in Interface Builder). This application delegate object is referenced by the delegate outlet on the file’s owner placeholder.

    So if I understand things correctly, the application loader loads the main nib file, setting itself as the nib owner. Its delegate property gets set to a fresh instance of your application delegate class, and so the loader knows where to dispatch the various application lifecycle event callbacks.

    There’s an awesome blog post about Cocoa application startup on Cocoa with Love.

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

Sidebar

Related Questions

I am developing an iOS application, and trying to zip the file I have
Have just started using Visual Studio Professional's built-in unit testing features, which as I
I have to develop an application which parses a log file and sends specific
I have custom view in my application which can be scrolled by the user.
I have a simple application which takes a text and password, generates a text
I have a producer/consumers design in my application which implement Produce/Consume functions on user
We have an application that support iAds. Apparently iOs 4.2 for iPad will support
Have just started using Google Chrome , and noticed in parts of our site,
Have you used VS.NET Architect Edition's Application and System diagrams to start designing a
Have a n-tire web application and search often times out after 30 secs. How

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.