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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:48:49+00:00 2026-05-27T15:48:49+00:00

My project is document-based, and the code to load a status menu is only

  • 0

My project is document-based, and the code to load a status menu is only executed if I put it under awakeFromNib.

#import "StatusMenuAppDelegate.h"

@implementation StatusMenuAppDelegate

@synthesize window = _window;

-(void)awakeFromNib {
    myStatusItem = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength] retain];
statusImage = [NSImage imageNamed:@"statusNorm.png"];
[myStatusItem setImage:statusImage];
[myStatusItem setHighlightMode:YES];
[myStatusItem setMenu:myStatusMenu];
}
@end

But, in my test project (non-document-based), the code is executed fine in applicationDidFinishLaunching. Why? Wouldn’t I want to ideally use this function for my status menu?

  • 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-27T15:48:49+00:00Added an answer on May 27, 2026 at 3:48 pm

    The applicationDidFinishLaunching: message is sent by the application object to its delegate. It is not sent to any other objects.

    You can certainly respond to that message in your document objects, but they will never receive it because nothing sends it to them. That’s why anything you do in that method in a document object, or any other object that isn’t the application’s delegate, doesn’t happen.

    awakeFromNib is one place you could create the status item. I would probably do it in windowControllerDidLoadNib:.

    That’s assuming you really want to have one status item per document, which probably doesn’t make sense. If that’s not what you want, you should move creation, ownership, and management of your status item to a singleton object, which should be created—probably within applicationDidFinishLaunching:—by the application’s delegate, and have any and all documents interact with that object as needed.

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

Sidebar

Related Questions

I have a project where a xsd document is loaded, and based on that
I am starting to put together a system architecture document for a new project
I have a project which requires me to load an HTML document as a
I'm trying to create a project-like document, in that it contains subdocuments in a
to my project i need document editor for many types of documents(tabular data, invoices,
I know I can do a find /replace by searching: Current Document Current Project
In our project we want to query a document management system for a specific
The Background A Cocoa Non Document Core Data project with two Managed Object Models.
I am about to start a new project and would like to document its
For our school project, we are tasked to define a design document describing the

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.