Re: Can't bind to NSApplication subclass on startup
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