Re: Properties being set to nil?


Jon Gotow
 

On Jan 16, 2020, at 10:48 AM, Dave <dave@...> wrote:

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?
The fact that you've got two instances of your LTWGameViewController certainly sounds like a bug. It's difficult to tell without looking at your whole project, but my guess is that you've got one instance loaded from the storyboard, and then you're creating a second one programmatically later. Can you just set an outlet to point to the instance loaded from your storyboard and leave it from that (that's what you should be doing unless you need multiple instances of LTWGameViewController in your app).

- Jon

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