1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

my application is not invoking "applicationDidFinishLaunching: " method

Discussion in 'Mac Programming' started by vnraju, Oct 28, 2007.

  1. macrumors newbie

    vnraju

    #1
    in my application....is unable to invoke
    applicationDidFinishLaunching: method.........
    suggestions plzzzzzz......
     
  2. Moderator

    robbieduncan

    Staff Member

    #2
    Would you care to elaborate on that? Your application should not invoke that method: NSApplication will invoke it automatically on it's delegate if it:

    a) has a delegate

    and

    b) the delegate responds to that message.
     
  3. macrumors newbie

    vnraju

    #3
    thanx for ur reply.....

    - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
    {

    NSLog (@"hi welcome");
    }

    do i need to change anything
    this is the piece of code i wrote in that method..........
     
  4. Moderator

    robbieduncan

    Staff Member

    #4
    It's a good idea to use [ code ] (without the spaces) tags around your code to prevent the insertion of :(

    That method only gets called if the object that it is a member of is instantiated and set as the NSApplication delegate. Are you doing that (if so where). Personally I normally create an instance of my application delegate and connect it in MainMenu.nib.
     
  5. macrumors newbie

    vnraju

    #5


    thank u so much that works fine ...i forget to connect to tha delegate............
     
  6. macrumors regular

    satyam90

    #6
    what is the code to connect that function to a delegate.
    How to declare a delegata and connect it to a function?
    Can you please let me know.
     
  7. Moderator

    robbieduncan

    Staff Member

    #7
    The first question makes no sense. You do not connect "functions" (which are really called methods) to delegates

    A delegate is simply an instance of an object. So you create a new class that implements the required methods.

    You can then either create an instance of this object in your code and connect it to another object via the setDelegate: method, or you can instantiate this class in your nib and connect it there via the normal connection dragging method.

    All of this is covered in any basic Cocoa introduction/tutorial.

    I suggest you start reading
     
  8. macrumors newbie

    #8
    Outside of Delegate?

    Is there a way to use this method outside of a delegate?
     
  9. Moderator emeritus

    kainjow

    #9
    You can subscribe to NSApplicationDidFinishLaunchingNotification notifications in any class.
     

Share This Page