I'm trying to make a Mac OSX program in Objective-C, and I'm trying to ca开发者_开发百科ll a method inside an NSObject
when the program is launched (opened by the user). I've tried so many different things. I'm still stuck on this.
Your question is quite vague. Are you using the Cocoa AppKit framework or are you trying to write a simple command-line tool using Objective-C? In the former, write an -applicationDidFinishLaunching:
method in your application delegate class and it will be called when, well when the app finishes launching. In the later case, just add code to your main()
method.
You can try notify_post("com.yourcompany.yourapp.themethod").
Or, just include the header of the NSObject and init, call the method.
精彩评论