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 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 have 2 iOS devices and an application which starts or connects to a
I want to create gallery application which would get thumbnails and metadata from web
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
We have an iOS app which has been approved for release with its version
Problem Description: We have a service which has applications for main mobile OS’s. We
I am a beginner to iOS development and have just started working with the
I am working in iOS 5,and before loading my application,I want to open a
Hi i am working on iOS SDK5 with xcode 4.2 and i want to
I have to develop an application which parses a log file and sends specific

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.