Re: Properties being set to nil?


Dave
 

Hi Sandor,

Yes, LTWGameViewController is a subclass of NSViewController and I set the Class in the Storyboard.

When I set a breakpoint in the Set Delegate method it shows the property set ok. Later on it responds to an IBAction and its set to nil. It certainly looks like there are 2 objects! Is this a bug? Is there a work-around?

Thanks a lot for your help.
Dave

On 16 Jan 2020, at 18:36, Sandor Szatmari <admin.szatmari.net@...> wrote:

I’ve seen this happen if the view controller is instantiated in code and in the NIB (not sure about storyboards)

It gets hooked up correctly one time and things are nil in the other case. Are you subclassing NSViewController and setting it to the class of a view controller in your storyboard? If so, and your also instantiating the view controller in code you’ll see two initializations of the object. One will be good and the other may or may not.

Sandor

On Jan 16, 2020, at 12:20, Dave <dave@...> wrote:

Join cocoa@apple-dev.groups.io to automatically receive all group messages.