Automatically Call a Function
Automatically Call a Function
- Subject: Automatically Call a Function
- From: Philip Lee Bridson <email@hidden>
- Date: Sun, 15 Jun 2008 18:09:34 +0100
Hi there - sorry this is actually two questions in one.
Firstly I need a function to automatically run from a class used in
MainMenu.nib when the main.m calls NSApplicationMain();
Also, I cannot figure out why when I initialize a window from a nib
or from a file before the call to NSApplicationMain() the program
crashes due to a memory leak. Please see below.
I have the usual: "return NSApplicationMain;" in the main file and it
loads the correct nib file absolutely fine. But then I want it to
perform certain functions, close itself and open a new window all
without user intervention. I can get it to do what I want but at the
moment the user has to push a button on the first window to kick off
the process, I would like to skip the need for user intervention.
I have tried to put the function in awakeFromNib but then the window
wont close itself from that function. I have also tried putting my
first window before the call to NSApplicationMain but then the
application crashes due to a memory leak, I have tried using an
autorelease pool and still it crashes when I try to initialize the
window. I tried both loading the window from nib file and a
programmed class but it just keeps crashing
Does anyone have any ideas as I have searched the docs and web and I
am still stuck - is there something I am missing?
Many thanks for any help that you can give.
Phil.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden