View Full Version : my application is not invoking "applicationDidFinishLaunching: " method
vnraju
Oct 29, 2007, 02:58 AM
in my application....is unable to invoke
applicationDidFinishLaunching: method.........
suggestions plzzzzzz......
robbieduncan
Oct 29, 2007, 03:05 AM
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.
vnraju
Oct 29, 2007, 03:09 AM
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.
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..........
robbieduncan
Oct 29, 2007, 03:12 AM
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.
vnraju
Oct 29, 2007, 03:15 AM
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.
thank u so much that works fine ...i forget to connect to tha delegate............
satyam90
Oct 31, 2007, 12:50 AM
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.
robbieduncan
Oct 31, 2007, 01:11 AM
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 (http://developer.apple.com/referencelibrary/GettingStarted/GS_Cocoa/index.html)
spudwaffle
Oct 21, 2010, 06:50 PM
Is there a way to use this method outside of a delegate?
kainjow
Oct 21, 2010, 09:29 PM
Is there a way to use this method outside of a delegate?
You can subscribe to NSApplicationDidFinishLaunchingNotification notifications in any class.
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.