• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Automatically Call a Function
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Automatically Call a Function


  • Subject: Re: Automatically Call a Function
  • From: "Stephen J. Butler" <email@hidden>
  • Date: Sun, 15 Jun 2008 13:29:31 -0500

On Sun, Jun 15, 2008 at 12:09 PM, Philip Lee Bridson
<email@hidden> 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.
_______________________________________________

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

References: 
 >Automatically Call a Function (From: Philip Lee Bridson <email@hidden>)

  • Prev by Date: Re: Could kEventAppSystemUIModeChanged arrive too early to my handler
  • Next by Date: Re: Automatically Call a Function
  • Previous by thread: Automatically Call a Function
  • Next by thread: Re: Automatically Call a Function
  • Index(es):
    • Date
    • Thread