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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:55:37+00:00 2026-05-24T13:55:37+00:00

I created a new window-based project and couldn’t figure out why it wasn’t doing

  • 0

I created a new window-based project and couldn’t figure out why it wasn’t doing anything. Eventually I put an NSLog right after didFinishLaunching and it’s never logged when I run it. Here is all of the code I have written:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    NSLog(@"didFinishLaunching");

    // Get the device object and turn proximity monitoring on
    UIDevice *d = [UIDevice currentDevice];
    [d setProximityMonitoringEnabled:YES];

    // Get the NSNotificationCenter object
    NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];

    // Sign up to receive notifications when the proximity state changes
    [nc addObserver:self selector:@selector(proximityChanged:) name:UIDeviceProximityStateDidChangeNotification object:d];
    NSLog(@"Observing...");

    [self.window makeKeyAndVisible];
    return YES;

}

- (void)proximityChanged:(NSNotification *)note {

    // Print out the changes of proximity state
    NSLog(@"Proximity Changed: %d", [[note object] proximityState]);

}

That’s the entirety of what I’ve written and nothing is logged when I run it on the simulator or on my device. Any thoughts?

  • 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-24T13:55:38+00:00Added an answer on May 24, 2026 at 1:55 pm

    Well, you are talking about Application Delegate. The obvious reason – your object is not set as an application delegate.

    Looking at Apple documentation there is quite a few ways to accomplish it:

    1. Remove application delegate binding in Interface Builder (.xib file for the window)
    2. Set 4th parameter of UIApplicationMain in main.h to something else than nil.

    Check you nib file in Interface Builder and see if the App Delegate is setup.

    Reference to documentation
    Core Application Design

    The application delegate is a custom object that you provide at
    application launch time, usually by embedding it in your application’s
    main nib file. The primary job of this object is to initialize the
    application and present its window onscreen. The UIApplication object
    also notifies this object when specific application-level events
    occur, such as when the application needs to be interrupted (because
    of an incoming message) or moved to the background (because the user
    tapped the Home button).


    The fourth parameter identifies the class of the application delegate.
    The application delegate is responsible for managing the high-level
    interactions between the system and your custom code. Specifying nil
    tells UIKit that the application delegate object is located in the
    application’s main nib file (which is the case for applications built
    using the Xcode templates).

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

Sidebar

Related Questions

I create new Window-Based project in xCode and a subclass of UIViewController name Main
I've created a new C++ project in Visual Studio 2008. No code has been
I create a new View-based Application project and modify the didFinishLaunchingWithOptions: method as follow.
I create a new View-based Application project and modify the didFinishLaunchingWithOptions: method as follow.
If I create a New Project in xcode, then choose View-based Application, the delegate
I've created a new project using the Visual Studio 2010's wizard. Once VS was
I've just created a new Windows XP VM on my Mac using VMware Fusion.
In Visual Studio, two files are created when you create a new Windows Form
I am new to Windows Mobile and created an app that needs to do
I created a new SharePoint portal for testing purposes using a manually added HOSTS

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.