Skip navigation.
 
mlRe: Automatically Call a Function
FROM : Stephen J. Butler
DATE : Sun Jun 15 20:29:31 2008

On Sun, Jun 15, 2008 at 12:09 PM, Philip Lee Bridson
<<email_removed>> wrote:
> 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


Make your controller the delegate of NSApplication and handle
applicationDidFinishLaunching:. Alternately, you can set yourself up
as a listener for the NSApplicationDidFinishLaunchingNotification.


The reason your app crashes before NSApplicationMain is because you
need to call at least NSApplicationLoad. But the proper way to do what
you want is from applicationDidFinishLaunching anyway.

Related mailsAuthorDate
mlAutomatically Call a Function Philip Lee Bridson Jun 15, 19:09
mlRe: Automatically Call a Function Stephen J. Butler Jun 15, 20:29
mlRe: Automatically Call a Function Marcel Weiher Jun 15, 20:31
mlRe: Automatically Call a Function Philip Lee Bridson Jun 15, 22:59
mlRe: Automatically Call a Function Ken Thomases Jun 15, 23:16
mlRe: Automatically Call a Function Philip Lee Bridson Jun 15, 23:25