• 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
Automatically Call a Function
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Automatically Call a Function
      • From: Marcel Weiher <email@hidden>
    • Re: Automatically Call a Function
      • From: "Stephen J. Butler" <email@hidden>
  • Prev by Date: Could kEventAppSystemUIModeChanged arrive too early to my handler
  • Next by Date: Re: Static Functions and Variables
  • Previous by thread: Re: Could kEventAppSystemUIModeChanged arrive too early to my handler
  • Next by thread: Re: Automatically Call a Function
  • Index(es):
    • Date
    • Thread