• 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: NSApplicationMain() doesn't set NSApp to my subclass
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSApplicationMain() doesn't set NSApp to my subclass


  • Subject: Re: NSApplicationMain() doesn't set NSApp to my subclass
  • From: "John C. Randolph" <email@hidden>
  • Date: Wed, 17 Aug 2005 14:05:06 -0700


On Aug 17, 2005, at 1:03 PM, Christopher Hickman wrote:

I have an app with a subclass of NSApplication, called SWLApplication. I've
set the custom class of File's Owner in MainMenu.nib to my subclass and I've
changed my principal class to SWLApplication in my application's target in
Xcode, but when I run my app NSApplicationMain() doesn't initialize the
NSApp global with an instance of my subclass. Instead, NSApp is an
NSApplication instance.


Am I missing a step somewhere?

Set the principle class for your application bundle. In "Info.plist", change:



<key>NSPrincipalClass</key> <string>NSApplication</string>

to:

    <key>NSPrincipalClass</key>
    <string>SWLApplication</string>

and that should get you squared away. I also would change the class of "file's owner" in the main nib file, but I'm not sure that's actually required.

-jcr



John C. Randolph <email@hidden> (408) 914-0013
Roaming Cocoa Engineer,
Available for your projects at great Expense and Inconvenience.



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >NSApplicationMain() doesn't set NSApp to my subclass (From: "Christopher Hickman" <email@hidden>)

  • Prev by Date: Re: Dependent Keys
  • Next by Date: Re: Should I set Core Data dependent key in the primary's setter?
  • Previous by thread: Re: Do I need to release IBOutlets in dealloc?
  • Next by thread: NSSegmentedControl with images configured in IB?
  • Index(es):
    • Date
    • Thread