• 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: Can't bind to NSApplication subclass on startup
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't bind to NSApplication subclass on startup


  • Subject: Re: Can't bind to NSApplication subclass on startup
  • From: Jonathan Taylor <email@hidden>
  • Date: Wed, 16 Jul 2014 12:27:10 +0100

> This suggests that something has already called +sharedApplication on NSApplication before the code you showed (or NSApplicationMain()).  Obviously, +sharedApplication only _creates_ an object on the first call.  In that case, it uses the receiver class to instantiate the application object.  But in other cases, it just returns the previously created object and the receiver doesn't matter.
>
> You need to track down that incorrect call to +sharedApplication.  You can set a symbolic breakpoint on +[NSApplication sharedApplication] but the breakpoint needs to be in effect before the process starts, not just by the time that main() is entered (which is where the debugger often stops when you tell it to break at launch).

Ah fantastic! Thankyou, that was indeed the problem. I was unthinkingly creating a singleton object as a global variable somewhere else in the code [probably not good style, but that was what I did…], and because that owns a window it was implicitly generating a call to +sharedApplication. Thanks for working that one out for me!

Cheers
Jonny
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >Can't bind to NSApplication subclass on startup (From: Jonathan Taylor <email@hidden>)
 >Re: Can't bind to NSApplication subclass on startup (From: Ken Thomases <email@hidden>)
 >Re: Can't bind to NSApplication subclass on startup (From: Jonathan Taylor <email@hidden>)
 >Re: Can't bind to NSApplication subclass on startup (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: Can't bind to NSApplication subclass on startup
  • Next by Date: Re: Suddenly, class interfaces in xib get more stuff
  • Previous by thread: Re: Can't bind to NSApplication subclass on startup
  • Next by thread: Managing your immense amount of classes in the Project Navigator
  • Index(es):
    • Date
    • Thread